run powershell as administrator context menu – Password Recovery https://www.top-password.com/blog Provide useful password recovery tricks, guides and software Sat, 29 Sep 2018 08:11:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.1 Add “Run with PowerShell (Admin)” Context Menu for .PS1 Files https://www.top-password.com/blog/add-run-with-powershell-admin-context-menu-for-ps1-files/ Sat, 29 Sep 2018 08:06:53 +0000 https://www.top-password.com/blog/?p=12952 How to add “Run as administrator” to PS1 file context menu in Windows 10? Before you can run PowerShell script with admin rights, you have to launch the elevated PowerShell console firstly. To simplify this process, you can add “Run with PowerShell (Admin)” to the right-click context menu for .PS1 files.

How to Add “Run with PowerShell (Admin)” Context Menu for .PS1 Files

  1. Open the Registry Editor. Paste the following registry location into the address bar, and then press Enter.

    HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell

    Right-click on the Shell key and select New->Key, name it “Run with PowerShell (Admin)“. Underneath that, create another subkey called “Command“.

  2. Select the Command subkey in the left pane, and then double-click the “(Default)” string in the right pane.

  3. Copy and paste the following command into the Value data field, and click OK.

    "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" ""& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File \"%1\"' -Verb RunAs}"

  4. Close Registry Editor. Now you should see a new context menu entry called “Run with PowerShell (Admin)” when you right-click any .PS1 script.
]]>