I am trying to install MSU through below PowerShell script, but its not getting installed. I am not aware of PowerShell scripting. Please someone give me best way to modified this script. I am looking forward to hear.
Start-Process "C:\Installer\windows10.0-kb4520062-x64_9f2a827f11f945d19bd26de6f113f611a38bb8a1.msu" -ArgumentList "/quiet /norestart"
In order to be able to pass arguments to a process launched via
Start-Process, the (possibly positionally implied)-FilePathargument must be a true executable, not just a document, which is what a.msufile is.Therefore, you must pass the executable that
.msufiles are registered to be processed by explicitly to-FilePath, which iswusa.exe(note the/quiet /norestartat the end of the-ArgumentListargument):Note:
In order to wait for the installation to finish, add the
-Waitswitch.To additionally check the process' exit code in order to determine whether the installation succeeded, add the
-PassThruswitch, capture the resulting process-info object in a variable, and then check its.ExitCodeproperty.However, there is a trick that simplifies the above: pipe the
wusa.execall toWrite-Output, which forces it to execute synchronously (as a GUI-subsystem application,wusa.exewould otherwise run asynchronously) and also records its exit code in the automatic$LASTEXITCODEvariable: