From b090555ce93b4da5d4dc65a0363844a4804507a7 Mon Sep 17 00:00:00 2001 From: Simon TheUser Date: Tue, 16 Nov 2021 13:34:40 -0500 Subject: [PATCH] Create new process with all command-line parameters when UAC is enabled --- bootstrap-salt.ps1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index a0d7042..ff857f8 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -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"