1

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 Answers1

1

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.

Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45
  • Would this elevate PowerShell, and would I be able to run CMD in elevated mode if I do this? – Camden LaCassa Feb 20 '17 at 16:25
  • @CamdenLaCassa: Yes , of course. go through the `get-help start-process`. You will get examples on how to open *nonewwindow* and all. – Ranadip Dutta Feb 20 '17 at 16:27
  • One of the problems with this is that it is not simply PowerShell, it is a GUI that I am making using PowerShell. I don't need to know how to elevate PowerShell, since I can set the GUI to prompt to run as administrative. I just need to know if I can run cmd in elevated mode using powershell.` – Camden LaCassa Feb 20 '17 at 19:14
  • Yes you can. The same way you can do that. – Ranadip Dutta Feb 21 '17 at 02:20