Welcome to MSDN Blogs Sign in | Join | Help

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

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" -Verb Runas -ArgumentList '-command "Get-Process"'

Hope this Helps,

James Brundage [MSFT]

Published Thursday, April 23, 2009 4:23 AM by PowerShellTeam
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Dew Drop - April 23, 2009 | Alvin Ashcraft's Morning Dew

Thursday, April 23, 2009 8:51 AM by Dew Drop - April 23, 2009 | Alvin Ashcraft's Morning Dew

# Dew Drop - April 23, 2009 | Alvin Ashcraft's Morning Dew

Thursday, April 23, 2009 8:51 AM by Dew Drop - April 23, 2009 | Alvin Ashcraft's Morning Dew

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

Neat, but is there a way to mimic the /env switch from the runas.exe command?

Thursday, April 23, 2009 5:56 PM by Dan

# Visual Studio Links #113

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. US ISV Developer Evangelism Team posted some links to money saving offers for ISVs when purchasing or upgrading Visual Studio or MSDN

Friday, April 24, 2009 11:35 AM by Visual Studio Hacks

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

Be sure to check out PowerScripting Podcast episode 68 where James talks about this and other cool v2 techniques.  It'll be posted sometime next week.  Watch the website: http://powerscripting.net.

-hal

PowerShell MVP & PowerScripting Podcast co-host

Friday, April 24, 2009 8:37 PM by Hal Rottenberg

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

That's a bit... verbose.  I'm thinking of something much shorter... maybe an acronym for "Super User DO something".

Nah, that's crazy talk :)

Sunday, April 26, 2009 2:55 AM by Ben L.

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker