|
- WScript.sleep 5000
- timeserv = "同步服务器 因为没权限发链接/?" & 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
复制代码 VBS丢开机启动就行,或者系统自带同步时间功能 修改注册表 让同步时间短一些,比如15分钟同步一次- Windows Registry Editor Version 5.00
- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers]
- @="0"
- "1"="time.windows.com"
- "2"="time.nist.gov"
- "0"="cn.ntp.org.cn"
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
- "AllowNonstandardModeCombinations"=dword:00000001
- "CompatibilityFlags"=dword:80000000
- "CrossSiteSyncFlags"=dword:00000002
- "Enabled"=dword:00000001
- "EventLogFlags"=dword:00000001
- "InputProvider"=dword:00000001
- "LargeSampleSkew"=dword:00000003
- "ResolvePeerBackoffMaxTimes"=dword:00000007
- "ResolvePeerBackoffMinutes"=dword:0000000f
- "SignatureAuthAllowed"=dword:00000001
- "SpecialPollInterval"=dword:00000168
复制代码
|
|