diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 index 7376cac3b8..056a1d8916 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 @@ -340,7 +340,10 @@ Pro / Business supports a single, ubiquitous install directory option. "$msiArgs $additionalInstallArgs" } else { - "$msiArgs $silentArgs $additionalInstallArgs" + "$msiArgs $silentArgs" + if ($additionalInstallArgs) { + " " + $additionalInstallArgs + } } $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msiArgs" "$($env:SystemRoot)\System32\msiexec.exe" -validExitCodes $validExitCodes -workingDirectory $workingDirectory @@ -353,7 +356,10 @@ Pro / Business supports a single, ubiquitous install directory option. $msiArgs = "$msiArgs $additionalInstallArgs"; } else { - $msiArgs = "$msiArgs $silentArgs $additionalInstallArgs"; + $msiArgs = "$msiArgs $silentArgs"; + if ($additionalInstallArgs) { + $msiArgs += " " + $additionalInstallArgs + } } $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msiArgs" "$($env:SystemRoot)\System32\msiexec.exe" -validExitCodes $validExitCodes -workingDirectory $workingDirectory @@ -365,7 +371,11 @@ Pro / Business supports a single, ubiquitous install directory option. $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$additionalInstallArgs" $fileFullPath -validExitCodes $validExitCodes -workingDirectory $workingDirectory } else { - $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$silentArgs $additionalInstallArgs" $fileFullPath -validExitCodes $validExitCodes -workingDirectory $workingDirectory + $exeArgs = $silentArgs + if ($additionalInstallArgs) { + $exeArgs += " " + $additionalInstallArgs + } + $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin -Statements "$exeArgs" -ExeToRun $fileFullPath -validExitCodes $validExitCodes -workingDirectory $workingDirectory } } @@ -375,7 +385,10 @@ Pro / Business supports a single, ubiquitous install directory option. $msuArgs = "`"$fileFullPath`" $additionalInstallArgs" } else { - $msuArgs = "`"$fileFullPath`" $silentArgs $additionalInstallArgs" + $msuArgs = "`"$fileFullPath`" $silentArgs" + if ($additionalInstallArgs) { + $msuArgs += " " + $additionalInstallArgs + } } $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msuArgs" "$($env:SystemRoot)\System32\wusa.exe" -validExitCodes $validExitCodes -workingDirectory $workingDirectory }