Wednesday, July 04, 2007

PowerShell Start-ElevatedProcess

Read this blog entry by Aaron Margosis.

This is how the JS stuff can be done in PowerShell - note how simple it is :)

Start-ElevatedProcess.ps1 -
param($program)
$sa=new-object -com shell.application
$sa.ShellExecute($program,"$args","","runas")

Example
Start-ElevatedProcess cmd /k ifmember /list

Define your own alias if you want e.g. -
New-Alias elevate Start-ElevatedProcess

No comments: