elevate-process (sudo) (modification of post by view diff)
View followups from Peter Provost | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/695"></script>download | new post
As a former UNIX guy, I love the non-admin stuff in Vista, but got annoyed keeping two shells open (one admin and one non-admin). I wanted sudo! PowerShell made that easy. Enjoy!
- function elevate-process
- {
- $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);
- }
- set-alias sudo elevate-process;
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository