April 22nd, 2009

V2 Quick Tip: Starting a new elevated process from a PowerShell script

PowerShell Team
PowerShell Team

One of the systems administration hurdles of the post-Vista world is figuring out how to make a script run as an administrator.

In PowerShell V2, using the Start-Process cmdlet, this is a one liner that will get the job done:

Start-Process"$psHome\powershell.exe"-VerbRunas-ArgumentList'-command "Get-Process"'

Hope this Helps,

James Brundage [MSFT]

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion is closed.