Using Chef to Run Windows update


Is it just me or is anyone else having issues using Chef to run windows update on remote nodes? I tend to use the PowerShell block to send a PowerShell command to run the windows update. When chef runs it immediately returns that the command has ran successfully yet when you log into the remote node and status the updates nothing changes (nothing happens). I am not trying to make this super hard by developing some elaborate scripts. I think something like this should be rather simple, but for some reason it isn't. Please share what your doing that is successful?

Thank you,


Can you post the block you used?


powershell_script 'Run Windows Update' do
    code <<-EOH
      Start-Process -FilePath "PowerShell" -ArgumentList "Install-WindowsUpdate -AcceptAll -AutoReboot" -Verb RunAs

Sorry for the delay... Let me know.

Thank you,

Hey @tas50 just following up with you. Let me know.

This person solved this in 2015 a certain way:

1 Like

And the PSWindowsUpdate module is not included with Powershell by default, which is where the Install-WindowsUpdate module comes from. I assume you're pre-installing that before you call your script?

This has more info:

There are lots of articles on the web about this.


Yes I user chef and several cookbooks is used for the pre-install and was hoping that it would work, but I have run into issues where it just doesn't work.

What I would recommend is dropping a script and setting up a scheduled task via Chef. IMO don't treat Chef like a scheduling service, it's config management. Updates can take time to install, sometimes requires reboots, etc.
You can checkout how we did this at FB.