Search code examples
windowspowershellpowershell-3.0

Powershell - Run Shortcut as Admin doesn't work (Windows)


i put an shortcut in shell:startup
if i deactivate "run as Administrator" the shortcut works fine
enter image description here But with admin rights (i need them) it wont show up
enter image description here

Thats the shortcut-proberties:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command "C:\Users\admin\Downloads\Execute_Windows_Update.ps1"

Execute_Windows_Update.ps1:

Set-ExecutionPolicy RemoteSigned
Install-Module -Name PSWindowsUpdate
Import-Module PSWindowsUpdate

Install-WindowsUpdate -AcceptAll -AutoReboot

Solution

  • Windows does not allow startup items to UAC elevate. This was strictly enforced in Vista

    Error message when you start a Windows Vista-based computer: "Windows has blocked some startup programs"

    This was relaxed a bit in 7 but some things are still probably blocked to prevent a flooding of UAC prompts at startup.

    The task scheduler is a way around this.