PoshCode Archive  Artifact [4e635ad4d1]

Artifact 4e635ad4d1261a338524f80c01ea7b2a39d0b42426af5fa6c8903560d2676317:

  • File elevate-process-sudo.ps1 — part of check-in [76dd597b6a] at 2018-06-10 14:22:41 on branch trunk — 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. Just put this in your $profile script. Enjoy! (user: Peter Provost size: 814)

# encoding: ascii
# api: powershell
# title: elevate-process (sudo)
# description: 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. Just put this in your $profile script. Enjoy!
# version: 0.1
# type: function
# author: Peter Provost
# license: CC0
# function: elevate-process
# x-poshcode-id: 696
# x-archived: 2017-03-11T01:38:32
# x-published: 2009-12-02T10:14:00
#
#
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;