'------------------------------------------------------------------------- 'Script configures the w32time service. ' '9/16/03 Todd Woolums (twoolums@toddwoolums.com) 'Version 1.0 '------------------------------------------------------------------------- strcomputer = "." const HKEY_LOCAL_MACHINE = &H80000002 Set oReg = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SYSTEM\CurrentControlSet\Services\W32Time\Parameters" strName = "Period" strValue = 65532 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strName,strValue strName = "type" strValue = "ntp" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strName,strValue strName = "ntpServer" strValue = "timeserv1.domain.com, timeserv2.domain.com, timeserv3.domain.com, timeserv4.domain.com" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strName,strValue strName = "LocalNTP" strValue = "00000001" oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strName,strValue Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colServiceList = objWMIService.ExecQuery _ ("Select * from Win32_Service where Name = 'W32Time'") For Each objService in colServiceList errReturn = objService.StopService() WScript.Sleep 25000 errReturn = objService.StartService() Next MsgBox "The W32time service is now configured.", vbOKOnly + vbInformation