Execute command "wuauclt" not working in windows Server 2012 R2

Hi people,
Im trying the next command on a windows Server 2012 R2 version

execute "Executin wuauclt" do
      command 'wuauclt /reportnow'
      action :run

And im getting wuauclt is not recognized as an internal or external command.
I tried :

  • To execute with full path: c:\windows…\wuauclt.exe
  • using cwd to set to wuauclt.exe folder.
    But all these tried give me the same error.

i dont use windows.

But this may be of help to you the windows cookbook: https://github.com/chef-cookbooks/windows

specifically the windows helpers : https://github.com/chef-cookbooks/windows/blob/0d709c348b0cfd1cb3f7885873e7513817a4df74/libraries/windows_helper.rb

if you include it in your metadata.rb to use

then try something like

# include Windows::Helper from Opscode Windows Cookbook
::Chef::Recipe.send(:include, Windows::Helper)

# now you can call helper methods like win_friendly_path directly
my_thing = win_friendly_path('c:/something/something')

execute "My thingy something" do
  command my_thing

good references: http://www.slideshare.net/opscode/chef-conf-windowsdougireton
and this blog post: http://dougireton.com/blog/2012/12/16/how-to-include-the-windows-cookbook-helper-methods-in-your-chef-recipe/

also just the github page for windows cookbook looks legit… always browse the LWRPs to see if you can get some direction/inspiration

seems pretty legit too… for finding the command and maybe saving it to a re-usable value to invoke from later.


The problem you are having is an “architecture” issue of 32bit vs. 64bit wuauclt is 64bit only and is not present when invoked from a 32bit process. Most run the chef-client as a 32 bit process and so you would expect to see this here. We do now ship a 64 bit chef client which should then recognize wuauclt. However you may not want to upgrade and in that case you also have the option of using the powershell_out

ruby_block 'run wuauclt' do
  block do
    Chef::Resource::RubyBlock.send(:include, Chef::Mixin::PowershellOut)
    powershell_out!("wuauclt /reportnow")

If you are using a recent version of chef (I believe 12.5.1 or later) then powershell_out should use a 64bit powershell.exe process.

1 Like

thanks this works for me :slight_smile: