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.
Related videos on Youtube
Author by
Francisco Laferrière
Updated on September 18, 2022Comments
-
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 almost 2 yearsIf you prefer using Windows Terminal instead of the default PowerShell terminal window, you can do
Start-Process wt powershell -Verb runAs
(yes, just addwt
!) to run thepowershell -Verb runAs
command in a new Windows Terminal window.