Windows update install


#1

Greetings Pro’s

There is patching schedule coming around and we need to update our windows machines , we have already configured the wsus settings manually and connected to our intranet,

all i need is a simple recipe to just check and install only the updates / i have referred community cookbooks / box starter and wsus -client which are more complex to work.

is there any powershell script that can be added to recipie would be helpful additionally

Thanks
Prash


#2

I would have a look at https://supermarket.chef.io/cookbooks/wsus-server for working with windows updates.


#3

You may find this ohai plugin useful for exposing the number of outstanding updates on hosts as well.

-Tim


#4

Sir appreciate for the immediate response but is there any recipe that can be written like

windows_services ‘Windows Updates’ do
action :download
end

Windows_services 'windows Update ’ do
action : install
end

im an beginner to software industry what i did so far is followed the Sops provided by my organisation i am excited to learn more in automation side

Thanks
Prash


#5

My apologies. I gave you the wrong link above. I should have given you the wsus client cookbook and not the server. See https://supermarket.chef.io/cookbooks/wsus-client. Have a read over the readme and I think you will find examples for just what you are trying to do.


#6

Greetings Sir,
Below is the error i get when im trying to run WSUS-Client cookbook

10.0.108.104 ================================================================================
10.0.108.104 Error executing action download on resource 'wsus_client_update[WSUS updates]‘
10.0.108.104 ================================================================================
10.0.108.104
10.0.108.104 WIN32OLERuntimeError
10.0.108.104 --------------------
10.0.108.104 (in OLE method Search': ) 10.0.108.104 OLE error code:80072EE6 in <Unknown> 10.0.108.104 <No Description> 10.0.108.104 HRESULT error code:0x80020009 10.0.108.104 Exception occurred. 10.0.108.104 10.0.108.104 Cookbook Trace: 10.0.108.104 --------------- 10.0.108.104 c:/chef/cache/cookbooks/wsus-client/providers/update.rb:86:inmethod_missing’
10.0.108.104 c:/chef/cache/cookbooks/wsus-client/providers/update.rb:86:in block in updates' 10.0.108.104 c:/chef/cache/cookbooks/wsus-client/providers/update.rb:84:intap’
10.0.108.104 c:/chef/cache/cookbooks/wsus-client/providers/update.rb:84:in updates' 10.0.108.104 c:/chef/cache/cookbooks/wsus-client/providers/update.rb:33:inblock in class_from_file’
10.0.108.104
10.0.108.104 Resource Declaration:
10.0.108.104 ---------------------
10.0.108.104 # In c:/chef/cache/cookbooks/wsus-client/recipes/update.rb
10.0.108.104
10.0.108.104 32: wsus_client_update ‘WSUS updates’ do
10.0.108.104 33: action :download
10.0.108.104 34: end
10.0.108.104 35:
10.0.108.104
10.0.108.104 Compiled Resource:
10.0.108.104 ------------------
10.0.108.104 # Declared in c:/chef/cache/cookbooks/wsus-client/recipes/update.rb:32:in from_file' 10.0.108.104 10.0.108.104 wsus_client_update("WSUS updates") do 10.0.108.104 action [:download] 10.0.108.104 retries 0 10.0.108.104 retry_delay 2 10.0.108.104 default_guard_interpreter :default 10.0.108.104 declared_type :wsus_client_update 10.0.108.104 cookbook_name "wsus-client" 10.0.108.104 recipe_name "update" 10.0.108.104 end 10.0.108.104 10.0.108.104 System Info: 10.0.108.104 ------------ 10.0.108.104 chef_version=12.21.3 10.0.108.104 platform=windows 10.0.108.104 platform_version=6.3.9600 10.0.108.104 ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32] 10.0.108.104 program_name=C:/opscode/chef/bin/chef-client 10.0.108.104 executable=C:/opscode/chef/bin/chef-client 10.0.108.104 10.0.108.104 10.0.108.104 [2017-08-14T09:38:53-04:00] INFO: Running queued delayed notifications before re-raising exception 10.0.108.104 [2017-08-14T09:38:53-04:00] ERROR: Running exception handlers 10.0.108.104 [2017-08-14T09:38:53-04:00] ERROR: Exception handlers complete 10.0.108.104 [2017-08-14T09:38:53-04:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out 10.0.108.104 [2017-08-14T09:38:53-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 10.0.108.104 [2017-08-14T09:38:53-04:00] FATAL: WIN32OLERuntimeError: wsus_client_update[WSUS updates] (wsus-client::update line 32) had an error: WIN32OLERuntimeError: (in OLE methodSearch’: )
10.0.108.104 OLE error code:80072EE6 in
10.0.108.104
10.0.108.104 HRESULT error code:0x80020009
10.0.108.104 Exception occurred.
ERROR: Failed to execute command on 10.0.108.104 return code 1
ERROR: Bootstrap command returned 1


#7

Does the node have access to the internet? It looks like it’s failing to download updates.


#8

yes it does have access to internet…


#9