ProTip: Open Powershell as admin from Powershell

 | #Powershell

Just a quick one as I find I have been using this trick a lot lately. If I am in a standard Powershell prompt and need to get an admin one open, I used to search for Powershell, right-click, run as admin. Iā€™d do this even if I was already in a Powershell prompt as I can never remember the syntax for runas.exe.

A much easier way, especially if you are already in a Powershell prompt is:

Start-Process powershell -verb runas

This works for any executable and will pop up UAC appropriately to allow you to enter credentials if you need to, or just run as admin if you are already an Administrator.

Hope this helps some one.

Edit

This can be further shortened to

Start powershell -verb runas

Thanks anonymous user!

About Alan Parr

Photo of Alan Parr

I am a .Net developer based in the Midlands in the UK, working on Azure, .Net Framework, .Net Core, and just generally playing around with anything that interests me. I play snooker (badly), archery (acceptably) and am a recovering Windows Phone user.