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`
$parameters = ""
If($minion -ne "not-specified") {$parameters = "-minion $minion"}
If($master -ne "not-specified") {$parameters = "$parameters -master $master"}
If($runservice -eq $false) {$parameters = "$parameters -runservice false"}
If($version -ne '') {$parameters = "$parameters -version $version"}
If($pythonVersion -ne "") {$parameters = "$parameters -pythonVersion $pythonVersion"}
foreach ($boundParam in $PSBoundParameters.GetEnumerator())
{
$parameters = "$parameters -{0} '{1}'" -f $boundParam.Key, $boundParam.Value
}
$newProcess.Arguments = $myInvocation.MyCommand.Definition, $parameters
# Specify the current working directory
$newProcess.WorkingDirectory = "$script_path"