UTC Cordinated universal Time

Greetings Professional’s,

Im am looking for a recipe that can change or configure the time zone to “UTC Cordinated universal Time” to all my windows and linux boxes . is that possible?, i have no clue how to write a recipe on this. can any one please help me on this.

Thanks
Prash

Time Zone information on Windows is stored in the following path in the registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

I exported the regkey and then made some settings changes, re-exported the key and then ran powershell (compare-object) to see what the differences were, so that I could then programatically make the changes using the chef registry_key resource as per this page.

Here is the compare I’ve done. The original time zone was (UTC+12:00) Auckland, Wellington and I have set the timezone to (UTC+12:00 Coordinated Universal Time+12

# The Compare-Object command using powershell

# First we need to get the data from the '.reg' files.
$OriginialRegistryKey = Get-Content .\timezone.reg
$NewRegistryKey = Get-Content .\timezonechange.reg

# Now we are going to use the Compare-Object command
Compare-Object -ReferenceObject $OriginialRegistryKey -DifferenceObject $NewRegistryKey

# Here is the output of the Compare-Object command
# The side indicator column tells me what data has changed, denoted by '=>' & '<='
# => is the Difference Object
# <= is the reference object.
InputObject                                                         SideIndicator
-----------                                                         -------------
"DaylightBias"=dword:00000000                                       =>
"DaylightName"="@tzres.dll,-1381"                                   =>
"DaylightStart"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 =>
"StandardName"="@tzres.dll,-1382"                                   =>
"StandardStart"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 =>
"TimeZoneKeyName"="UTC+12"                                          =>
"ActiveTimeBias"=dword:fffffd30                                     =>
"DaylightBias"=dword:ffffffc4                                       <=
"DaylightName"="@tzres.dll,-741"                                    <=
"DaylightStart"=hex:00,00,09,00,05,00,02,00,00,00,00,00,00,00,00,00 <=
"StandardName"="@tzres.dll,-742"                                    <=
"StandardStart"=hex:00,00,04,00,01,00,03,00,00,00,00,00,00,00,00,00 <=
"TimeZoneKeyName"="New Zealand Standard Time"                       <=
"ActiveTimeBias"=dword:fffffcf4                                     <=

So, once you know what data needs to change in the registry, you can then use the chef registry resource to prgramatically make these changes.

NOW - To make the changes on Linux, you could use the system cookbook from the Chef Supermarket.

# Install this using knife 
knife supermarket install system

As for using the system cookbook for Linux/Unix, looks easy. You just need to create a LWRP recipe that would set the values (EG: node['system']['timezone'] == mytimezone) and include the system cookbook

GOOD LUCK!

Thank you Sir you made my day…!