Time sync and Windows


I’d always believed that the only requirement for synchronizing time on Windows machines is the NET TIME. This command allows clients to sychronize their clocks with a domain controller (DC) and the server version has a command line option to allow an external time server to be specified. Certainly the domain’s clients sychronize their clocks with the DC correctly.

However I noticed notification emails coming from the server ever sooner and assumed there to be a problem with the remote server’s clock. It turned out the server was correct and that the DCs clock was drifting taking all the clients with it.

So it seems you can use the command

1
<strong>NET TIME /setsntp:[external time server]</strong>
<strong>NET TIME /setsntp:[external time server]</strong>

but it has no effect. The trick is to use w32tm which is the command line counter part the W32TIME service. The following three commands when run on the DC will address the problem:

1
2
3
w32tm /config /manualpeerlist:time.nist.gov,0x8 /syncfromflags:MANUAL
net stop w32time
net start w32time
w32tm /config /manualpeerlist:time.nist.gov,0x8 /syncfromflags:MANUAL
net stop w32time
net start w32time

I got this information from this blog post which has many other examples and for other operating systems.

Update: 2011-09-30

This post from the Virtual PC Guy’s blog adds further information. Although the steps above work for a standalone server or a PDC running on its own hardware, they don’t work when the PDC is a virtual machine (in my case Hyper-V). This because the Hyper-V integration components install a time server time provider called VCIMTimeProvider which synchronizes the VM guest machine with the clock on the host instead of the external service that’s been configured. That’s OK if the host’s clock is OK and not drifting but if it’s taking time from the PDC which is taking time from the host which… The trick is to disable the VMICTimeProvider by running the following command:

1
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider /v Enabled /t reg_dword /d 0
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider /v Enabled /t reg_dword /d 0

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!