Add Open PowerShell As Admministrator Here to Context Menu

Instructions

Powershell Script

Windows Registry Editor Version 5.00

; Created by:Shawn Brink
; Created on: August 13, 2016
; Updated on: April 29, 2020
; Tutorial: https://www.tenforums.com/tutorials/60177-add-open-powershell-window-here-administrator-windows-10-a.html



[HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShellAsAdmin]
@="Open PowerShell window here as administrator"
"Extended"=-
"HasLUAShield"=""
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShellAsAdmin\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs\""


[HKEY_CLASSES_ROOT\Directory\shell\PowerShellAsAdmin]
@="Open PowerShell window here as administrator"
"Extended"=-
"HasLUAShield"=""
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\Directory\shell\PowerShellAsAdmin\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs\""


[HKEY_CLASSES_ROOT\Drive\shell\PowerShellAsAdmin]
@="Open PowerShell window here as administrator"
"Extended"=-
"HasLUAShield"=""
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\Drive\shell\PowerShellAsAdmin\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs\""


[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\PowerShellAsAdmin]
@="Open PowerShell window here as administrator"
"Extended"=-
"HasLUAShield"=""
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\PowerShellAsAdmin\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs\""


; To allow mapped drives to be available in elevated PowerShell
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLinkedConnections"=dword:00000001

Open Windows PowerShell Here as Administrator

Remove Context Menu Item