Microsoft:Time
In the documentation below, I have inserted the host north-america.pool.ntp.org as the NTP peer in the commands.
Configuring the Windows Time service on a standalone workstation
On a Microsoft Windows based workstation which is not a member of a domain:
w32tm /config /manualpeerlist:"time-a.nist.gov time-b.nist.gov north-america.pool.ntp.org" /syncfromflags:manual /update net stop w32time net start w32time w32tm /resync
When specifying multiple peers, use a space as the delimiter and enclose them in quotation marks.
Verifying changes using the Event Log
In the Windows System Event Log, you should see the following message after a successful sync:
Source: W32Time EventID: 35 Description: The time service is now synchronizing the system time with the time source mypdc.mydomain.loc (ntp.d|10.10.20.154:123->192.168.1.10:123).
Configuring the Windows Time service on machines in an Active Directory domain
Configuring a time source for the forest
On the PDC emulator using external synchronization:
w32tm /config /manualpeerlist:"time-a.nist.gov time-b.nist.gov north-america.pool.ntp.org" /syncfromflags:manual /reliable:yes /update net stop w32time net start w32time w32tm /resync
On the PDC emulator using internal hardware clock:
w32tm /config /syncfromflags:domhier /reliable:yes /update net stop w32time net start w32time
On the previous PDC emulator:
w32tm /config /syncfromflags:domhier /reliable:no /update net stop w32time net start w32time w32tm /resync
On domain client workstations:
w32tm /config /syncfromflags:domhier /update net stop w32time net start w32time w32tm /resync
Determining the shape of time syncing on your domain
Use the following command to see what time synchronization looks like between your domain controllers:
w32tm /monitor
This is what you will see on a domain with a single domain controller (which is your PDCe):
C:\>w32tm /monitor
MyPDC.MyDomain.local *** PDC *** [192.168.0.5]:
ICMP: 0ms delay.
NTP: +0.0000000s offset from MyPDC.MyDomain.local
RefID: time-a.nist.gov [129.6.15.28]
This is what you will see in a domain with multiple domain controllers:
C:\>w32tm /monitor
server-1.MyDomain.local *** PDC *** [10.10.10.245]:
ICMP: 0ms delay.
NTP: +0.0000000s offset from server-1.MyDomain.local
RefID: time-a.nist.gov [129.6.15.28]
server-2.MyDomain.local [10.10.10.242]:
ICMP: 0ms delay.
NTP: -0.0086221s offset from server-1.MyDomain.local
RefID: server-1.MyDomain.local [10.10.10.245]
server-3.MyDomain.local [10.10.15.10]:
ICMP: 6ms delay.
NTP: -0.0046789s offset from server-1.MyDomain.local
RefID: server-1.MyDomain.local [10.10.10.245]
server-4.MyDomain.local [10.10.14.245]:
ICMP: 16ms delay.
NTP: -0.0060164s offset from server-1.MyDomain.local
RefID: server-1.MyDomain.local [10.10.10.245]
server-5.MyDomain.local [10.10.12.3]:
ICMP: 36ms delay.
NTP: -0.0377464s offset from server-1.MyDomain.local
RefID: server-1.MyDomain.local [10.10.10.245]
The NTP line shows the time offset of each server as compared to the PDCe.
The RefID shows the current sync peer of each server.
In the above case, each domain controller is synching its time from the PDCe, and the PDCe is synching its time from an external NTP source.
Restoring the Windows Time service to default settings
net stop w32time w32tm /unregister w32tm /register net start w32time
Batch file to configure everything on your network with one script
Update the script with YOURPDCE hostname and save to a batch file.
@echo off IF %COMPUTERNAME% EQU YOURPDCE GOTO setuppdce :setupnonpdce echo Setting up non PDCe system... echo Resetting to defaults... net stop w32time w32tm /unregister w32tm /register net start w32time echo Configuring non PDCe system for domain sync... w32tm /config /syncfromflags:domhier /update net stop w32time net start w32time w32tm /resync goto end :setuppdce echo Setting up PDCe system... echo Resetting to defaults... net stop w32time w32tm /unregister w32tm /register net start w32time echo Configuring PDCe for external NTP sync... w32tm /config /manualpeerlist:"time-a.nist.gov time-b.nist.gov north-america.pool.ntp.org" /syncfromflags:manual /reliable:yes /update net stop w32time net start w32time w32time /resync goto end :end pause
Batch file to configure a remote computer as a non-PDCe machine with domain sync
@echo off IF %COMPUTERNAME% EQU YOURPDCE GOTO end w32tm /config /computer:%1% /syncfromflags:domhier /update w32tm /resync /computer:%1% :end