首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >腾讯云Windows时间跳变到未来若干天的解决方案

腾讯云Windows时间跳变到未来若干天的解决方案

原创
作者头像
Windows技术交流
发布于 2024-09-02 17:41:41
发布于 2024-09-02 17:41:41
6070
举报
文章被收录于专栏:Windows技术交流Windows技术交流

最终方案

1、打全补丁

2、执行下面给的powershell设置健壮性较高的内网校时

解决方案,管理员身份执行以下powershell代码设置可靠的内网ntp server校时,前提是内网ntp server域名解析正常

ntpupdate.tencentyun.com

time1.tencentyun.com

time2.tencentyun.com

time3.tencentyun.com

time4.tencentyun.com

time5.tencentyun.com

代码语言:txt
复制
【powershell】代码
#解决超过15小时不能校时的问题
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\Config" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\Config" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\W32Time\Config" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\W32Time\Config" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\Config" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\Config" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f


#禁用STS
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config"|findstr UtilizeSslTimeData

reg add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v UtilizeSslTimeData /t REG_DWORD /d 0 /f

net stop w32time 2>&1 > $null

sc.exe triggerinfo w32time delete ; sc.exe config w32time start= auto

sc.exe triggerinfo w32time start/networkon stop/networkoff

net start w32time


#配置1分钟校时
reg add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v "MinPollInterval" /t reg_DWORD /d 5 /f

reg add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v "MaxPollInterval" /t reg_DWORD /d 10 /f

reg add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" /v "SpecialPollInterval" /t reg_DWORD /d 60 /f

reg add "HKLM\SOFTWARE\Policies\Microsoft\W32Time\TimeProviders\NtpClient" /v "SpecialPollInterval" /t reg_DWORD /d 60 /f

reg add "HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\W32Time\TimeProviders\NtpClient" /v "SpecialPollInterval" /t reg_DWORD /d 60 /f

w32tm /config /update

#配置内网ntp server校时
#w32tm /config /manualpeerlist:"ntpupdate.tencentyun.com,0x8 time1.tencentyun.com,0xa time2.tencentyun.com,0xa time3.tencentyun.com,0xa time4.tencentyun.com,0xa time5.tencentyun.com,0xa" /syncfromflags:manual /reliable:yes /update
#

net stop w32time 2>&1 > $null

net start w32time

#配置后触发校时
w32tm /resync 2>&1 > $null

start-sleep 3

w32tm /resync 2>&1 > $null

start-sleep 3

w32tm /resync 2>&1 > $null


#开机校时和vnc 8小时问题fix
schtasks.exe /create /tn "\start_w32time" /ru SYSTEM /rl highest /sc ONSTART /tr "c:\windows\system32\sc.exe start w32time" /f
schtasks /change /tn "\start_w32time" /ru SYSTEM /st 00:00 /sd 1900/01/01 #中文版时间格式1900/01/01 #英文版时间格式01/01/1900
schtasks /change /tn "\start_w32time" /enable

reg query "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f
reg query "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档