设置WindowServer2012 时间同步NTP

在powershell中以管理员身份运行以下命令即可

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL
Stop-Service w32time
Start-Service w32time

W32tm is the command to use. Sure, there are articles out there mentioning “net time”, but you should not use that. Some other also mentions editing the registry directly, but as Microsoft mentions in the article: It is recommended that you do not directly edit the registry unless there is no other alternative. But if you really want to check the registry, it’s here: HKLMSystemCurrentControlSetServicesW32Time.

查看当前时间同步状态

w32tm /query /status

image

调试信息

开启调试

w32tm /debug /enable /file:C:Tempw32tmdebug.log /size:10485760 /entries:0-300

关闭调试

w32tm /debug /disable

强制重新同步

w32tm /resync
Sending resync command to local computer
The command completed successfully.

参考

Configuring NTP on Windows Server 2012

Configuring NTP on Windows 2008 R2

原文地址:https://www.cnblogs.com/HQFZ/p/5765351.html