Add PowerShell As Administrator Context Menu in Windows 10

PowerShell is an advanced form of command prompt. It is extended with a huge set of ready-to-use cmdlets and comes with the ability to use .NET framework/C# in various scenarios. In this article, we'll see how to add "Open PowerShell here as administrator" to the context menu in Windows 10.

Open PowerShell Here As Administrator
Adding this command to the context menu will allow you to quickly open a new elevated PowerShell instance in the current directory that you right clicked on or are browsing with File Explorer.

To add "Open PowerShell here as administrator" to the context menu in Windows 10, do the following.

Apply the Registry tweak listed below. Paste its contents inside Notepad and save as a *.reg file.

Tip: Here's how to tweak your PC to ensure top performance for a specific type of task, be it gaming, document work or something else.

Powershell Admin Context Menu Tweak Contents

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedPS]
@="Open PowerShell here as administrator"
"Icon"="powershell.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedPS\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/c,pushd %V && powershell' -Verb RunAs\""

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

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedPS\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/c,pushd %V && powershell' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedPS]
@="Open PowerShell here as administrator"
"Icon"="powershell.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedPS\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/c,pushd %V && powershell' -Verb RunAs\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedPS]
@="Open PowerShell here as administrator"
"Icon"="powershell.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedPS\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/c,pushd %V && powershell' -Verb RunAs\""

In Notepad, press Ctrl + S or execute the File - Save item from the File menu. This will open the Save dialog. There, type or copy-paste the name "ps.reg" including quotes.Powershell Admin Context Menu Save Tweak

Double quotes are important to ensure that the file will get the "*.reg" extension and not *.reg.txt. You can save the file to any desired location, for example, you can put it in your Desktop folder.

Double click the file you created, confirm the import operation and you are done.Powershell Admin Context Menu Import Tweak

Now right-click any folder.Open PowerShell Here As Administrator

You can enable this context menu quickly with Winaero Tweaker. It comes with the following option:

Winaero Tweaker Powershell Menu

You can download the app from here:

Download Winaero Tweaker

To save your time, I made ready-to-use Registry files. You can download them here:

Download Registry Files

The undo tweak is included.

Driver Updater

5 thoughts on “Add PowerShell As Administrator Context Menu in Windows 10

  1. Jara

    hi, i tried it, but WPS window immediately disappears – am i doing something wrong?

    Reply
  2. Piohm

    Hello!
    Same experience as Jara. PowerShell closes in less than 0,25 second and a classic command prompt opens afterward.

    Reply
    1. Sergey Tkachenko Post author

      Hello,
      Please tell me:
      Which OS version you are running?
      Which method you have used to add the context menu command?

      Reply
  3. Michaël Polla

    Like the others have mentioned, it opens a command prompt ; in fact, a command prompt running PowerShell.

    Reply
  4. Jordan

    Hi Sergey
    This one has always opened command prompt for me, ever since it was first added. Now on Win10 Enterprise 1803, still instantly closes powershell and automatically opens cmd instead. Hope you get to work on a solution. Thanks for all the effort, been using WInaero for years, always appreciated.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.