Create new process with all command-line parameters when UAC is enabled

This commit is contained in:
Simon TheUser 2021-11-16 13:34:40 -05:00 committed by Pedro Algarvio
parent 4387dfd260
commit e209b259d2

View file

@ -133,13 +133,11 @@ If (!(Get-IsAdministrator)) {
# Specify the current script path and name as a parameter` # Specify the current script path and name as a parameter`
$parameters = "" $parameters = ""
If($minion -ne "not-specified") {$parameters = "-minion $minion"} foreach ($boundParam in $PSBoundParameters.GetEnumerator())
If($master -ne "not-specified") {$parameters = "$parameters -master $master"} {
If($runservice -eq $false) {$parameters = "$parameters -runservice false"} $parameters = "$parameters -{0} '{1}'" -f $boundParam.Key, $boundParam.Value
If($version -ne '') {$parameters = "$parameters -version $version"} }
If($pythonVersion -ne "") {$parameters = "$parameters -pythonVersion $pythonVersion"}
$newProcess.Arguments = $myInvocation.MyCommand.Definition, $parameters $newProcess.Arguments = $myInvocation.MyCommand.Definition, $parameters
# Specify the current working directory # Specify the current working directory
$newProcess.WorkingDirectory = "$script_path" $newProcess.WorkingDirectory = "$script_path"