powershell - Admin script won't relaunch as admin on reboot -


i'm trying run script run powershell script upon reboot. i'm using hklm\software\microsoft\windows\currentversion\run key.

my problem script launches upon reboot, runs non-admin ps window. gives me "access denied". i've disabled uac on system, same error. how can launch admin powershell window when reboots?

currently have:

reg add hklm\software\microsoft\windows\currentversion\run /v runthis /t reg_sz /f /d "c:\windows\system32\windowspowershell.exe -executionpolicy unrestricted -file c:\script.ps1 -verb runas

assuming not access denied when run manually, should resolve issue. open powershell admin prompt. key in -

set-executionpolicy remotesigned 

now add run key -

"c:\windows\system32\windowspowershell\v1.0\powershell.exe" -file c:\script.ps1  

Comments