Last active
January 30, 2016 00:18
Revisions
-
Yer Yang revised this gist
Jan 30, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ function Start-ElevatedUACSession { } $cmd = [string]::Join(" ", $args) Write-Host "Executing Elevated: $cmd" Start-Process powershell -Verb "runAs" -WindowStyle Hidden -Wait -ArgumentList "/Command ""& { $cmd > '$($outputFiles.Standard)' }""" Get-Content $outputFiles.Standard $outputFiles.Values | Remove-Item } -
sweeneyrobb revised this gist
Jan 30, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ function Start-ElevatedUACSession { } $cmd = [string]::Join(" ", $args) Write-Host "Executing Elevated: $cmd" Start-Process powershell -Verb "runAs" -WindowStyle Hidden -Wait -ArgumentList "/Command ""& { $cmd > $($outputFiles.Standard) }""" Get-Content $outputFiles.Standard $outputFiles.Values | Remove-Item } -
sweeneyrobb revised this gist
Jan 29, 2016 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,12 @@ function Start-ElevatedUACSession { $outputFiles = @{ Standard = [System.IO.Path]::GetTempFileName(); Error = [System.IO.Path]::GetTempFileName(); } $cmd = [string]::Join(" ", $args) Write-Host "Executing Elevated: $cmd" Start-Process powershell -Verb "runAs" -WindowStyle Hidden -PassThru -ArgumentList "/Command ""& { $cmd > $($outputFiles.Standard) }""" Get-Content $outputFiles.Standard $outputFiles.Values | Remove-Item } Set-Alias sudo Start-ElevatedUACSession -
sweeneyrobb revised this gist
Jan 29, 2016 . 1 changed file with 7 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,8 @@ function Start-ElevatedUACProcess { $splat = @{'FilePath'=$args[0];'Verb'='runAs' } $argList = $args[1..($args.Length)] if ($argList) { $splat.Add("ArgumentList", $argList); } Start-Process @splat } Set-Alias sudo Start-ElevatedUACProcess -
yangyer created this gist
Jan 29, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ Function Start-ElevatedUAC{ $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 fudo Start-ElevatedUAC;