Thursday, July 15, 2021

使用 W32tm 替 Windows 10 設定 NTP 校時伺服器

 w32tm /query /status /verbose  查詢校正時間動作狀態 




w32tm /stripchart /computer:tw.pool.ntp.org /samples:30  查詢30次 NTP server 並顯示時間偏差圖  /dataonly 僅顯示資料




w32tm /config /manualpeerlist:tw.pool.ntp.org /syncfromflags:ALL or manual   /reliable:yes /update  手動設定 ntp server 並 UPDATE 資料




另外可能還涉及下面的 系統管理範本


gpedit.msc

本機- 電腦設定- windows 設定- 安全性設定-本機原則-使用者權限指派-變更時區  增加使用者帳號 

gpedit.msc

本機- 電腦設定- 系統管理範本- 系統- Windows時間服務-
打開全域設定,
設定時間提供者 -設定Windows NTP 用戶端 其中的NTP  Server 及 SpecialPollInterval 增加時間位移量容許值從300秒--> 1200秒


及registry 


1 設定tw.pool.ntp.org 為服務伺服器

2 設定服務型態為 NTP



HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time


reg 檔案如下:


Windows Registry Editor Version 5.00




[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time]




[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\Config]


"FrequencyCorrectRate"=dword:00000004


"HoldPeriod"=dword:00000005


"LargePhaseOffset"=dword:02faf080


"MaxAllowedPhaseOffset"=dword:000004b0


"MaxNegPhaseCorrection"=dword:0002a300


"MaxPosPhaseCorrection"=dword:0002a300


"PhaseCorrectRate"=dword:00000001


"PollAdjustFactor"=dword:00000005


"SpikeWatchPeriod"=dword:00000384


"UpdateInterval"=dword:00000064


"AnnounceFlags"=dword:0000000a


"EventLogFlags"=dword:00000002


"LocalClockDispersion"=dword:0000000a


"MaxPollInterval"=dword:0000000a


"MinPollInterval"=dword:00000006


"ClockHoldoverPeriod"=dword:00001e78


"RequireSecureTimeSyncRequests"=dword:00000000


"UtilizeSslTimeData"=dword:00000001


"ClockAdjustmentAuditLimit"=dword:00000320


"ChainEntryTimeout"=dword:00000010


"ChainMaxEntries"=dword:00000080


"ChainMaxHostEntries"=dword:00000004


"ChainDisable"=dword:00000000


"ChainLoggingRate"=dword:0000001e




[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\Parameters]


"NtpServer"="tw.pool.ntp.org"  


"Type"="NTP"   




[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\TimeProviders]




[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\W32Time\TimeProviders\NtpClient]


"CrossSiteSyncFlags"=dword:00000002


"ResolvePeerBackoffMinutes"=dword:0000000f


"ResolvePeerBackoffMaxTimes"=dword:00000007


"SpecialPollInterval"=dword:00000e10


"EventLogFlags"=dword:00000000


"Enabled"=dword:00000001





No comments: