0

I try to install .msu package using Poweshell. My code:

$Args = @(('"' + $Path_Temp + '\' + $Hotfix[1] + '.msu' + '"'), '/norestart')
echo $Args
Start-Process -FilePath ($Env:SystemRoot + '\System32\wusa.exe') -ArgumentList $Args -Verb RunAs -Wait

echo outputs this:

"C:\Users\MyUser\AppData\Local\Temp\Windows6.1-KB2758857-x64.msu"
/norestart

All looks good, but in the end wusa warns me about incorrect usage. It works well when I pass only the first argument (which is the path to .msu file) to ArgumentList. My code does not work when I pass multiple arguments, why? I use Powershell v5.1.14409.1005

user3600124
  • 829
  • 1
  • 7
  • 19
  • Try with `$Args = @(($Path_Temp + '\' + $Hotfix[1] + '.msu'), '/norestart')` – Santiago Squarzon Jul 04 '22 at 03:40
  • Does not work either. Also I would like double-quotes to stay there in case path includes spaces – user3600124 Jul 04 '22 at 03:42
  • 1
    Might be possible that the issue is because [_"The `/norestart` switch is ignored if the `/quiet` switch is not present."_](https://support.microsoft.com/en-us/topic/description-of-the-windows-update-standalone-installer-in-windows-799ba3df-ec7e-b05e-ee13-1cdae8f23b19) also the forced quotes surrounding the path are probably not needed – Santiago Squarzon Jul 04 '22 at 03:45
  • Yes! It installed now as I put `/quiet` as second argument (and `/norestart` as third). It shoud have ignored `/norestart` in case `/quiet` is not present. Not to outright refuse to proceed, didn't it? Thank You – user3600124 Jul 04 '22 at 03:51

0 Answers0