For years, I have been using the instructions similar to the Microsoft article to configure Windows 2012 servers as NTP client. Basically as a local Windows administrator, modify Windows registry settings. I put all settings into a plain text file as below and import the file.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
"MaxPosPhaseCorrection"=dword:0002a300
"AnnounceFlags"=dword:00000005
"MaxNegPhaseCorrection"=dword:0002a300
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
"NtpServer"="ntp1.local.com,0x1 ntp2.local.com,0x1"
"Type"="NTP"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
"SpecialPollInterval"=dword:00000384
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer]
"Enabled"=dword:00000001
It’s been working fine until recently I had to deploy a new Windows 2012 VM to test an upgrade. As I’ve done before, I imported the NTP configuration file into the Windows registry, enabled W32Time service and started it. It didn’t work this time — it didn’t pick up the registry settings. When querying source, configuration, status, it reported “LOCAL” as the source. When querying peers (NTP server list), it returned 0.
C:\Program Files\VMware\VMware Tools>w32tm /query /source
Local CMOS Clock
C:\Program Files\VMware\VMware Tools>w32tm /query /peers
#Peers: 0
C:\Program Files\VMware\VMware Tools>w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 1 (primary reference - syncd by radio clock)
Precision: -6 (15.625ms per tick)
Root Delay: 0.0000000s
Root Dispersion: 10.0000000s
ReferenceId: 0x4C4F434C (source name: "LOCL")
Last Successful Sync Time: 7/13/2021 6:36:05 PM
Source: Local CMOS Clock
Poll Interval: 10 (1024s)
C:\Program Files\VMware\VMware Tools>w32tm /query /configuration
[Configuration]
EventLogFlags: 2 (Local)
AnnounceFlags: 5 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 10 (Local)
MaxPollInterval: 15 (Local)
MaxNegPhaseCorrection: 54000 (Local)
MaxPosPhaseCorrection: 54000 (Local)
MaxAllowedPhaseOffset: 1 (Local)
FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 1 (Local)
UpdateInterval: 360000 (Local)
[TimeProviders]
NtpClient (Local)
DllName: C:\Windows\system32\w32time.DLL (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 604800 (Local)
Type: NTP (Policy)
NtpServer: (Policy)
VMICTimeProvider (Local)
DllName: C:\Windows\System32\vmictimeprovider.dll (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
NtpServer (Local)
DllName: C:\Windows\system32\w32time.DLL (Local)
Enabled: 0 (Local)
InputProvider: 0 (Local)
My first thought was something to do with VMware tools, but it’s not enabled. Confirmed the VM setting “Synchronize Time with Host” not checked within vSphere client
c:\Program Files\VMware\VMware Tools>VMwareToolboxCmd.exe timesync status
Disabled
Tried to use “Change date and time settings” GUI -> “Internet Time Settings”. It didn’t help.
Tried to unregister/register W32time service, resync/rediscover, manul update NTP server address. Restarted W32time every time I made a change. None worked.
w32tm /config /manualpeerlist:ntp1.local.time /syncfromflags:manual /reliable:yes /update
w32tm /resync /rediscover
w32tm /unregister
w32tm /register
net stop w32time
net start w32time
Eventually it worked with Group Policy editor. Using gpedit.msc, went to “Administrative template” -> “System” -> “Windows Time Service” -> “Time Providers”. On the left pane, enabled the following two settings:
- “Enable Windows NTP Client”
- “Configure Windows NTP Client”
Entered the NTP server information when in “Configure Windows NTP Client“.
Note:
Default value [0x9] is appended to the end of each DNS name. It means [0x01] + [0x08]. They mean like follows:
- 0x01 SpecialInterval
- 0x02 UseAsFallbackOnly
- 0x04 SymmetricActive
- 0x08 NTP request in Client mode
For “Type” section, It’s OK to keep default [NT5DS] if your computer is in a Domain, but if not, change to [NTP].
Not sure why this time I needed to use the Group Policy editor and what has made this VM different than others I’ve worked on. Maybe I was just lucky before?
Another thing to note, right after a restart of Windows Time service, the source might be reverted back to “LOCL”. run command “w32tm /resync /rediscover” will redetect the settings of external NTP servers. Or wait for a few minutes, the service will pick up the settings.
For how to use w32tm, please see the Microsoft knowledge article: