Run PowerShell scripts as Administrator from Explorer context menu

in #windows4 years ago

Sometimes Windows is lacking options in the context menu, i. e. executing PowerShell scripts with administrative privileges.

The explorer context menu doesn't provide an option for start the PowerShell with administrative privileges, it provide only the option to execute PowerShell scripts.

The Widnows Regristy - broken as it is - provides the tools to enable this.

For with this run with Win+R "regedit" and navigate to the path: <code>HKCR:\Microsoft.PowerShellScript.1\Shell\\</code>.

Add new Folder/Key with text which needs to be displayed as value. (i.g. "Run as Administrator").

Under this create a Folder/Key called "Command" and place a default key and but this value to it:

<code>"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" ""& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File \"%1\"' -Verb RunAs}"</code>

Final Result

Or just use the PowerShell for that - but make sure that the PowerShell in run with administrative privileges. The script can find be here.

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 60870.17
ETH 3385.85
USDT 1.00
SBD 2.57