Advertisement
gmknowles

Add Shift + Right Click "Open PowerShell window here as administrator" Context Menu

Mar 20th, 2023
166
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShellAsAdmin]
  4. @="Open PowerShell window here as administrator"
  5. "Extended"=""
  6. "HasLUAShield"=""
  7. "Icon"="powershell.exe"
  8.  
  9. [HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShellAsAdmin\command]
  10. @="powershell -WindowStyle Hidden -NoProfile -Command \"Start-Process -Verb RunAs powershell.exe -ArgumentList \\\"-NoExit -Command Push-Location \\\\\\\"\\\"%V/\\\\\\\"\\\"\\\""
  11.  
  12.  
  13. [HKEY_CLASSES_ROOT\Directory\shell\PowerShellAsAdmin]
  14. @="Open PowerShell window here as administrator"
  15. "Extended"=""
  16. "HasLUAShield"=""
  17. "Icon"="powershell.exe"
  18.  
  19. [HKEY_CLASSES_ROOT\Directory\shell\PowerShellAsAdmin\command]
  20. @="powershell -WindowStyle Hidden -NoProfile -Command \"Start-Process -Verb RunAs powershell.exe -ArgumentList \\\"-NoExit -Command Push-Location \\\\\\\"\\\"%V/\\\\\\\"\\\"\\\""
  21.  
  22.  
  23. [HKEY_CLASSES_ROOT\Drive\shell\PowerShellAsAdmin]
  24. @="Open PowerShell window here as administrator"
  25. "Extended"=""
  26. "HasLUAShield"=""
  27. "Icon"="powershell.exe"
  28.  
  29. [HKEY_CLASSES_ROOT\Drive\shell\PowerShellAsAdmin\command]
  30. @="powershell -WindowStyle Hidden -NoProfile -Command \"Start-Process -Verb RunAs powershell.exe -ArgumentList \\\"-NoExit -Command Push-Location \\\\\\\"\\\"%V/\\\\\\\"\\\"\\\""
  31.  
  32.  
  33. [-HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\PowerShellAsAdmin]
  34.  
  35.  
  36. ; To allow mapped drives to be available in elevated PowerShell
  37. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
  38. "EnableLinkedConnections"=dword:00000001
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement