How to run an elevated command prompt through powershell

2.6k Views Asked by At

I am making a Powershell GUI program so I can easily change audit, and password settings with the click of a button. I already have the code to do this, but it's written in batch and so I run it in cmd using CMD /C " "to solve that problem. The new problem is that I need to run CMD in elevated mode to actually perform the code. I am using SAPIEN PowerShell Studio 2017 to create the program.

1

There are 1 best solutions below

4
On BEST ANSWER

Once you are inside the Powershell:

Start-Process PowerShell –Verb RunAs

or directly from the cmd prompt, you can do like this:

powershell -Command "Start-Process PowerShell –Verb RunAs"

Hope it helps.