Chef on Windows Tip: Windows Package Install Error on Bootstrap

I’ve seen the following error a few times when bootstrapping Chef on a Windows server:

* windows_package[Windows Management Framework Core 5.1] action install[2017-12-22T12:05:38-06:00] INFO: Processing windows_package[Windows Management Framework Core 5.1] action install (powershell::powershell5 line 41)

======================================================Error executing action `install` on resource ‘windows_package[Windows Management Framework Core 5.1]’

======================================================Mixlib::ShellOut::ShellCommandFailed

————————————

Expected process to exit with [0, 42, 127, 3010, 2359302], but received ‘5’

—- Begin output of start “” /wait “c:\chef\cache\wmf51\win7andw2k8r2-kb3191566-x64.msu” /quiet /norestart & exit %%%%ERRORLEVEL%%%% —-

—- End output of start “” /wait “c:\chef\cache\wmf51\win7andw2k8r2-kb3191566-x64.msu” /quiet /norestart & exit %%%%ERRORLEVEL%%%% —-

Ran start “” /wait “c:\chef\cache\wmf51\win7andw2k8r2-kb3191566-x64.msu” /quiet /norestart & exit %%%%ERRORLEVEL%%%% returned 5

The problem is we are trying to install a MSU package over WinRM which isn’t allowed.  Typically I avoid this issue by running Chef as a scheduled task but in this case I’m bootstrapping over WinRM.  In addition, I’m assigning a role at the same time which attempts to run the full set of Chef cookbooks.  The easy fix is to bootstrap without the role and then after add the role.  Then the cookbooks will be applied from the scheduled task and everything should be fine.

Happy Configuring!

Leave a Reply