Thoughts from the EPS Windows Server Performance Team
Useful Microsoft Blogs
Hello AskPerf readers. My name is Edwin Rocky and this is my first post on the blog. I had recently worked on a case where we noticed that on a Windows Server 2008 R2 machine when we use the Wmic command to set the automatic page file setting to be disabled, it changes the Time Zone information to Unrecognized.
Command used was “wmic computersystem set automaticmanagedpagefile = false”:
After successfully executing this command, if you open the Calendar you will notice the following error as shown below. The Time Zone information changes to not recognized.
When you click on the “Change data and Time Settings” you will still notice that under the time zone you see the following information:
The reason was that this command had removed the TimeZoneKeyName value from the registry key location under:
This is due to an older API being used during this process, and has the unintended consequence of clearing that key.
You can simply go back and set the Time Zone information using the GUI. But in case you are in the process of doing automation where you need to disable the page file for multiple machines then this may not be a feasible option. In this case you can use the following simple .reg export and .reg import commands as a workaround to achieve this. We can add the following commands in the automation script:
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation TimeZone.Reg Wmic ComputerSystem Set AutomaticManagedPageFile=False Reg import TimeZone.Reg
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation TimeZone.Reg
Wmic ComputerSystem Set AutomaticManagedPageFile=False
Reg import TimeZone.Reg
These basically backs up the existing registry key, runs the Wmic command to disable the pagefile and then imports the registry key back to the same location.
Note: The file TimeZone.Reg will be saved to the location from where you initiated the Reg command in the Cmd line. You must also run the Cmd prompt elevated, since it will not otherwise has permissions to write to HKLM. You can provide a designated path to store the .reg file by providing the complete path of the file, like so:
For a network share:
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation \\2008Server\Sharedfolder\TimeZone.Reg Wmic ComputerSystem Set AutomaticManagedPageFile=False Reg import \\2008Server\Sharedfolder\TimeZone.Reg
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation \\2008Server\Sharedfolder\TimeZone.Reg
Reg import \\2008Server\Sharedfolder\TimeZone.Reg
For a local drive:
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation D:\Regsitry\TimeZone.Reg Wmic ComputerSystem Set AutomaticManagedPageFile=False Reg import D:\Regsitry\TimeZone.Reg
Reg export HKLM\System\CurrentControlSet\Control\TimeZoneInformation D:\Regsitry\TimeZone.Reg
Reg import D:\Regsitry\TimeZone.Reg
You might want to read KB974028 on the appropriate usage of this Wmic command, as well as the following:
Till next time..