Re: WMI Script to Set The EnableDaylightSavingsTime

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Paul E. wrote:

   I am a real beginner with vbscript.  I have found very little on the
net pertaining to the scripting of Win32_ComputerSystem
EnableDaylightSavingsTime.  I was wondering if anyone had or could
easily creat a script that will not only read the setting, but will
also set it TRUE if it is not already.

Hi,

Why test if it is set to True already? Easier to just set it to True
regardless of previous value.

This script should work fine for WinXP and Win2k3 Server (note that it
will not work for Win2k):

'--------------------8<----------------------

' Connect to the WMI object on current computer
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")

For Each objItem in colItems
 objItem.EnableDaylightSavingsTime = True
 objItem.Put_
Next
'--------------------8<----------------------



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
.