When you delve into this problem, as mentioned by related tasks, there is no way to start the UAC โnoโ elevated process from the elevated process. Since this is exactly what I need, and the runas solution did not work for me, I reworked a workaround for the code provided by Microsoft to use the scheduled task to run the โnotโ elevated process.
An example of starting powershell.exe as an โnotโ elevated process from an elevated prompt:
$apppath = "powershell.exe" $taskname = "Launch $apppath" $action = New-ScheduledTaskAction -Execute $apppath $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname | Out-Null Start-ScheduledTask -TaskName $taskname Start-Sleep -s 1 Unregister-ScheduledTask -TaskName $taskname -Confirm:$false
The above powershell commands only work on Windows Server 2012 / Windows 8 and above.
Or you can use SCHTASKS.EXE instead to cover most versions of windows:
$apppath = "powershell.exe" $taskname = "Launch $apppath" schtasks /create /SC ONCE /ST 23:59 /TN $taskname /TR $apppath schtasks /run /tn $taskname Start-Sleep -s 1 schtasks /delete /tn $taskname /F
source share