使用w32tm或PowerShell在所有AD成员(旧的和新连接的)上设置NTP服务器?

我正在寻找一个只在DC上运行一次的PowerShell脚本。 我发现w32tm,但我不知道如何使用它。 提前致谢!

在您的PDCe上,并且仅在您的PDCe FSMOangular色持有者上,您应该通过发出如下命令与外部时间源同步:

w32tm /config /manualpeerlist:"0.us.pool.ntp.org,0x8 1.us.pool.ntp.org,0x8" /syncfromflags:manual /reliable:yes /update 

你当然可以select你自己的NTP服务器。 0x8标志告诉WIndows Time以“客户端”模式运行,即它只能作为pool.ntp.org服务器的客户端。

所有其他Active Directory域成员都会自动使用AD域控制器select过程来自动查找NTP服务器。 您永远不需要在域成员上手动configurationWindows Time。 (或者不是PDCe的其他域控制器。)

如果你已经有了,并且只想把它们返回到默认configuration,那么就这样做

net stop w32time

w32tm /unregister

w32tm /register

net start w32time

我不使用使用W32TM,PowerShell或任何工具。 而是通过组策略来configurationNTP。

我在域控制器OU中创build一个名为“在PDC模拟器上configurationNTP”的策略,并使用安全筛选将其仅应用于PDC模拟器。 保留所有其他的默认设置。

Windows时间设置位于“ Computer Configuration\Administrative Templates\System\Windows Time Service和“ Computer Configuration\Administrative Templates\System\Windows Time Service\Time Providers 。 您至less需要configuration“ Configure Windows NTP Client ,“ Enable Windows NTP Client ,还可能需要在“ Global Configuration SettingsEnable Windows NTP Server