I’m very new to powershell scripting, but I found that I need to use it.
I solved almost everything that I need with ps1, but the problem is with UAC now.
In maxscript I use the code as follows to run ps1, and it runs the script with UAC promts:
local ShellPath = "C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe" local procInfo = dotnetobject "System.Diagnostics.ProcessStartInfo" ShellPath procInfo.Arguments = "-noprofile -executionpolicy bypass -File " + "\"" + ShellFile + "\"" procInfo.Verb = "runas" -- run as administrator procInfo.useShellExecute = on -- run as administrator procInfo.CreateNoWindow = on procInfo.WindowStyle = (DotNetClass "System.Diagnostics.ProcessWindowStyle").Hidden -- hide console local DotNetHandle = dotnetclass "System.Diagnostics.Process" local SharingProcess = undefined try ( SharingProcess = DotNetHandle.Start procInfo SharingProcess.StartInfo.WindowStyle=(DotNetClass "System.Diagnostics.ProcessWindowStyle").Hidden ) catch ( print "error launching Shell" return false )
I need it to use from a tool that will be installed to many computers. I don’t want to turn of UAC promts, just bypass it.