做了一个时间同步工具,大家测试一下

查看 139|回复 15
作者:phwike   
view520   
[ol]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[/ol]复制代码VBS丢开机启动就行,或者系统自带同步时间功能 修改注册表 让同步时间短一些,比如15分钟同步一次[ol]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[/ol]复制代码
cqlgcgs123   
支持原创
cqlgcgs123   
XP系统 运行不了
view520   

p1509101 发表于 2025-5-29 12:44
VBS丢开机启动就行,或者系统自带同步时间功能 修改注册表 让同步时间短一些,比如15分钟同步一次

没VBS的机子,你玩个球。
WinPE系统很多不支持VBS的,你这个能提供的授时服务器也少,我那个提供多个授时服务器,也可以加上自己选择的授时服务器,设置时间用延迟最少的授时服务器。
cqlgcgs123   
这个好,谢谢老大!
cqlgcgs123   
支持一下
view520   
一直用 About Time。
view520   
系统不是有时间同步功能吗
view520   
感谢分享,需要
您需要登录后才可以回帖 登录 | 立即注册

返回顶部