Time sync on non-domain joined servers
Solution 1
I configure NTP like you with the w32tm /configure /manualpeerlist:
command.
To change windows so that w32time starts on reboot issue the following command:
sc triggerinfo w32time delete
If you want to check the triggered state of a service you can do so by:
C:\Windows\system32>sc qtriggerinfo w32time
[SC] QueryServiceConfig2 SUCCESS
SERVICE_NAME: w32time
START SERVICE
DOMAIN JOINED STATUS : <clip> [DOMAIN JOINED]
STOP SERVICE
DOMAIN JOINED STATUS : <clip> [NOT DOMAIN JOINED]
Solution 2
As you self-discovered, NTP configuration in Windows can be a pain. While you can surely make it working, I strongly suggest you to use something as NetTime or (if you need true, awesome NTP accuracy) this port of NTP for Windows.
Anyway, regarding the incosistencies between w32time and what the GUI shows, for http://www.timesynctool.com/ we read:
The Windows Time Service in Windows 7 is also configured by default to not start automatically each time the system is started - the user interface reports that Windows is configured to automatically update the system time, but it doesn't unless the user manually starts the Windows Time Service either through the Services Control Panel applet, or by requesting a manual sync. Unless the user reconfigures the Windows Time Service to start automatically, it will be effectively disabled every time the system is restarted!
Related videos on Youtube
dbr
Updated on September 18, 2022Comments
-
dbr almost 2 years
I have a server which is in a workgroup in a separate network from the rest of the domain. As a result, it cannot use the domain controllers as a time source. The server is a Windows Server 2012 R2 machine.
I'd like to ensure the server is configured to retrieve its time from a list of reliable NTP servers that are within my country, but I'm having some difficulty working out how best to configure this.
My first thought was to configure the machine in much the same way you would configure your PDC in a domain environment so it gets its time from one or more external time sources. The command line would look something like the following:
w32tm /configure /manualpeerlist:"ntp1.npl.co.uk ntp2.npl.co.uk" /syncfromflags:manual /update
This sets the appropriate registry values in the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Parameters
key.Unfortunately that command fails because the 'Windows Time' (AKA w32time) service isn't started. Investigation reveals that on a non-domain-joined server, the Windows Time Service is set to 'Manual (Trigger Start)', with the trigger being whether the machine is joined to a domain. Since it isn't, the service hasn't started.
Since the service isn't running, you might think that means configuring w32time to use specific NTP servers would do nothing. However, there's also a built-in scheduled task named
SynchronizeTime
located inTask Scheduler Library\Microsoft\Windows\Time Synchronization\SynchronizeTime
that starts the w32time service with thetask_started
argument. This seems to cause the service to start, synchronise and then immediately stop again. What's even more odd is that the task has no triggers, yet it does run periodically. I can't find any way of determining what causes the task to run.To further add to the confusion, there's also the setting you see in the Date and Time dialog on the 'Internet Time' tab:
It appears this setting relates to a completely different registry key that also contains a list of NTP servers. The key is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
So, all of the above has left me wondering just what is the correct way to achieve what I want to do. I'd also be interested in know the answers to any of these questions:
- Why are there two systems that appear to do the same thing?
- How does the second one work?
- How do they interact?
- Which should I be using?
- How is the scheduled task triggered?
-
R-X over 7 yearsCan't you set the service to automatically start and refer to the manual configuration as per your commands or manual reg entries?
-
dbr almost 8 yearsThanks for the suggested alternatives. I'm not sure that snippet from timesynctool.com is entirely correct (either that or it's referring to the behavior in an older release). As I mentioned in my post, even if the service isn't running, the scheduled task still seems to start the service periodically so it syncs, although it stops again once the sync is complete - at least that's what's happening on another workgroup server I have. If I have time, I'll build up a fresh install and do some tests to confirm.