How to elevate PowerShell without closing the actual one?

11,129

To do so is very easy! Just run the command within the same PowerShell that states:

Start-Process powershell -Verb runAs

And voila! UAC will prompt you and you'll have a new window from where you can execute the command you want.

Share:
11,129

Related videos on Youtube

Francisco Laferrière
Author by

Francisco Laferrière

Updated on September 18, 2022

Comments

  • Francisco Laferrière
    Francisco Laferrière over 1 year

    This is something that tends to happen that involves trying to run a command such as "rm -r" or something similar, and you realize you are not elevated to admin rights on that PowerShell window.

    Normally you'll have to open the start menu, select the PowerShell icon, and right click it to select "run as admin".

    How do I avoid all those steps?

  • Admin
    Admin almost 2 years
    If you prefer using Windows Terminal instead of the default PowerShell terminal window, you can do Start-Process wt powershell -Verb runAs (yes, just add wt!) to run the powershell -Verb runAs command in a new Windows Terminal window.