Open Powershell From Here

by JohnieK1 in Circuits > Microsoft

985 Views, 6 Favorites, 0 Comments

Open Powershell From Here

context menu.png

This instructable will teach you how to add a context menu option that will open PowerShell from your current location.

Open Powershell As Administrator

open power shell as admin.png

Open an elevated powershell

Paste Code

powershell.png

Run the following code in your elevated PowerShell window.


$menu = 'Open Windows PowerShell Here as Administrator'

$command = "$PSHOME\powershell.exe -NoExit -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 '' }