Time Zone information on Windows is stored in the following path in the registry:
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.
"TimeZoneKeyName"="New Zealand Standard Time" <=
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