Windows Update – What Does Wusa.exe Return Code 5 Mean?

windows-update

I'm trying to install powershell 4.0 on a server via chocolatey. It fails with:

[ERROR] [ERROR] Running wusa.exe with C:\Users\jdearing\AppData\Local\Temp\chocolatey\Powershell4\Powershell4Install.msu /quiet /norestart /log:"C:\Chocolatey\lib\powershell4.4.0.0.20131204\tools\PowerShell.v4.Install.log" was not success ful. Exit code was '5'.

I get nothing in the application log, and that log appears to be binary data. I can't find a list of return codes for wusa.exe.

Best Answer

Windows update will not permit you to perform installs over Powershell Remote sessions since it does not allow any remote authentication token. This does not only affect the running of routine updates but also the installation of windows features via dism and servermanager as well as many Microsoft MSIs. Looks like Windows Management 4 is among them. The best way around this is to create a scheduled task to perform this on the remote machine. As noted above PSEXEC works too provided provided file access ports are open and, if you are not in a domain environment, you have enabled LocalAccountTokenFilterPolicy.

I recently added this functionality to Boxstarter.org as of version 2.0. With this you can install chocolatey packages, windows features or windows updates remotely and Boxstarter will create a scheduled task from the remote powershell session. It will stream the output back to your session so it looks and feels like it is running from inside the session. See http://boxstarter.org/InstallingPackages#RemoteInstallations for details.

In Short the command looks like:

$cred=Get-Credential username
Install-BoxstarterPackage -ComputerName box1,box2 -Credential $cred -PackageName Powershell4