This is what I am trying to accomplish:
I need the user to automatically run the powershell script when he logs into the computer, the script launches the Powershell Promoted link (just as if the user could click Run Runshell as Administrator), and then he runs some commands in a new Powershell object, and then closes a new Powershell object.
This function will now create and run a new Powershell object in elevated mode.
function Set-Elevation
{
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "powershell";
$newProcess.Verb = "runas";
[System.Diagnostics.Process]::Start($newProcess) | Out-Null
}
However, how do I get him to run new teams? And how can I close the object later?
Any syntax tips would be appreciated.
source
share