how to start Powershell with administrator mode ?

There are multiple ways to start powershell in administrator mode:

1> From GUI – Go to start -> run -> search for “powershell” -> it will show multiple results, then right click on the “Windows Powershell” -> select “run as administrator”.

2> From Schedule task – If you are planning to execute powershell from schedule task then there is option under “general” tab to run the schedule task with “highest privileges”. you can refer “how to create schedule task using powershell” for more detail

3> From Powershell console – You can also use start-process powershell cmdlets to start powershell in administrator mode as below but it will open another powershell console with administrator mode.

if you want to pass you script to new console and keep the execution going on then you can use below code at start of your script.

[gistpen id=”398″]

 


(Visited 2 times, 1 visits today)
, , , ,

By Arun Sabale

Arun is a Solution Architect on enterprise client management with more than 14 years of experience in IT. Arun Sabale is Blogger and tech enthusiast. His main focus is on Azure cloud infra, Cloud automation with powershell, python, ARM terraform and all cloud infra services like compute, storage, network, automation, function api etc... LinkedIN - https://www.linkedin.com/in/arun-sabale/