Created
December 14, 2011 20:34
-
-
Save jpoehls/1478380 to your computer and use it in GitHub Desktop.
Elevate-Process (sudo) for PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your PowerShell profile. | |
function Elevate-Process | |
{ | |
<# | |
.SYNOPSIS | |
Runs a process as administrator. Stolen from http://weestro.blogspot.com/2009/08/sudo-for-powershell.html. | |
#> | |
$file, [string]$arguments = $args | |
$psi = New-Object System.Diagnostics.ProcessStartInfo $file | |
$psi.Arguments = $arguments | |
$psi.Verb = "runas" | |
$psi.WorkingDirectory = Get-Location | |
[System.Diagnostics.Process]::Start($psi) | Out-Null | |
} | |
Set-Alias sudo Elevate-Process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment