|
SynTime.vbs
- timeserv = "http://time.windows.com/?" & Now()
- Set http = CreateObject("microsoft.xmlhttp")
- http.open "GET",timeserv,false
- http.send
- gmttime = http.getResponseHeader("Date")
- gmttime = Right(gmttime, Len(gmttime) - 5)
- gmttime = Left(gmttime, Len(gmttime) - 3)
- gmttime = CDate(gmttime)
- Set http = Nothing
- dtmNewDateTime=Right(String(4,"0") & Year(gmttime),4) &_
- Right(String(2,"0") & Month(gmttime),2) &_
- Right(String(2,"0") & Day(gmttime),2) &_
- Right(String(2,"0") & Hour(gmttime),2) &_
- Right(String(2,"0") & Minute(gmttime),2) &_
- Right(String(2,"0") & Second(gmttime),2) &_
- ".000000+000"
- Set objWMIService=GetObject("winmgmts:{(Systemtime)}\\.\root\cimv2")
- Set colOSes=objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
- For Each objOS In colOSes
- objOS.SetDateTime dtmNewDateTime
- Next
复制代码 |
|