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

2024-09-02 17:41:41 浏览数 (3)

最终方案

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_MACHINESOFTWAREPoliciesMicrosoftW32TimeConfig" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftW32TimeConfig" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINESOFTWAREWow6432NodePoliciesMicrosoftW32TimeConfig" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINESOFTWAREWow6432NodePoliciesMicrosoftW32TimeConfig" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesw32timeConfig" /v MaxNegPhaseCorrection /t reg_dword /d 4294967295 /f

reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesw32timeConfig" /v MaxPosPhaseCorrection /t reg_dword /d 4294967295 /f


#禁用STS
reg query "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeConfig"|findstr UtilizeSslTimeData

reg add "HKLMSYSTEMCurrentControlSetServicesW32TimeConfig" /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 "HKLMSYSTEMCurrentControlSetServicesW32TimeConfig" /v "MinPollInterval" /t reg_DWORD /d 5 /f

reg add "HKLMSYSTEMCurrentControlSetServicesW32TimeConfig" /v "MaxPollInterval" /t reg_DWORD /d 10 /f

reg add "HKLMSYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClient" /v "SpecialPollInterval" /t reg_DWORD /d 60 /f

reg add "HKLMSOFTWAREPoliciesMicrosoftW32TimeTimeProvidersNtpClient" /v "SpecialPollInterval" /t reg_DWORD /d 60 /f

reg add "HKLMSOFTWAREWow6432NodePoliciesMicrosoftW32TimeTimeProvidersNtpClient" /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:windowssystem32sc.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_MACHINESystemCurrentControlSetControlTimeZoneInformation" /v RealTimeIsUniversal
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetControlTimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f
reg query "HKEY_LOCAL_MACHINESystemCurrentControlSetControlTimeZoneInformation" /v RealTimeIsUniversal

0 人点赞