PoshCode Archive  Artifact [895bd1f430]

Artifact 895bd1f430f0f0b0063dbb4251815862224a1581ad4536a8b596c06fcfc67ea0:

  • File Start-Elevated.ps1 — part of check-in [2a216948a1] at 2018-06-10 12:59:38 on branch trunk — A simple function based on http://www.peterprovost.org/archive/2007/02/25/22315.aspx to launch a process elevated — basically, this is the UAC equivalent of sudo (and therefore, will almost always require you to at least click OK). (user: Joel Bennett size: 759)

# encoding: ascii
# api: powershell
# title: Start-Elevated
# description: A simple function based on http://www.peterprovost.org/archive/2007/02/25/22315.aspx to launch a process elevated — basically, this is the UAC equivalent of sudo (and therefore, will almost always require you to at least click OK).
# version: 0.1
# type: function
# author: Joel Bennett
# license: CC0
# function: Start-Elevated
# x-poshcode-id: 165
# x-archived: 2017-04-30T13:05:41
# x-published: 2008-04-03T10:10:00
#
#
#function Start-Elevated {
   param ($app) 
   $psi = new-object "System.Diagnostics.ProcessStartInfo"
   $psi.FileName = $app; 
   $psi.Arguments = [string]$args; 
   $psi.Verb = "runas";
   [System.Diagnostics.Process]::Start($psi)
#}