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.\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.

  • 1
    Windows System Error Code 5 is Access Denied. – user9517 Dec 4 '13 at 21:13
  • Maybe because I was doing it from a psremoting session. Guess I'd need procmon to troubleshoot. – Justin Dearing Dec 4 '13 at 21:15
  • I ran into a similar problem and the consensus online seems to be that wusa.exe does not work properly over PSRemoting. Most people (including myself) end up reverting to psExec to run wusa.exe remotely. – jbsmith Dec 4 '13 at 21:54

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.