Cooking on Windows Sever..

Hi guys!

I have to manage Windows Server 2008 using Chef..

First of all, I need to choose the strategy for bootstrapping the new node and I am going to use an unattended bootstrap..

Configuring network card to talk with (my Chef server)

Screen Shot 2016-08-04 at 18.19.09

Download and install  chef-client for Windows from

Screen Shot 2016-08-04 at 15.41.06.png

Copy client.rb and validation.pem to c:\chef and launch chef-client from the command line.

This my new Windows node!

Screen Shot 2016-08-04 at 18.09.15

Let’s prepare a simple cookbook named mywindows:

knife cookbook create mywindows

Let’s insert the following resources in recipes/default.rb

#Modify the hosts file
template "C:\\Windows\\System32\\drivers\\etc\\hosts" do
  source "hosts.erb"
  action :create


#Restart an array of services
[ "Dnscache" , "UxSms" ].each do |s|
 service s do
    action :restart


#Update Group Policy
execute 'gpupdate' do
  command "gpupdate.exe"


#Create a key into the registry
windows_registry 'HKCU\Software\Test' do
  values 'MySuperKEy' =>
  action :create


#Install Putty
windows_package 'Putty' do
  source 'C:\\putty-0.60-installer.exe'
  installer_type :inno
  action :install


#Enable a Windows Feature
windows_feature "WindowsServerBackup" do
  action :install

Run chef-client and all works fine!

Screen Shot 2016-08-04 at 18.34.08.png




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s