Add 'Open Powershell here as admin' option to folder context menu
This is the only way I know of to currently add this feature to context menus in Windows Explorer:
[Run this script in an elevated powershell prompt]
$menu = 'Open Windows PowerShell Here as Administrator'
$command = "$PSHOME\powershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""
'directory', 'directory\background', 'drive' | ForEach-Object {
New-Item -Path "Registry::HKEY_CLASSES_ROOT\$_\shell" -Name runas\command -Force |
Set-ItemProperty -Name '(default)' -Value $command -PassThru |
Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
Set-ItemProperty -Name HasLUAShield -Value ''
}
This script taken from the following link:
http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/
I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).
If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.