I’m running Windows Server 2008 R2 as a Hyper-V host. The domain controller runs as a guest. Following Microsoft’s recommendation, the host is not joined to the domain; it is a stand-alone workgroup client.
Even if you set Windows Time service to Automatic start, it stops within a few seconds. Why? How do you set up Windows Time to behave like it would on a domain client?
Service Trigger Events: The Japanese Secret
When I noticed that the Windows Time service wasn’t running, I found that it did in fact start when the system started, but then it stopped a few seconds later with this message:
Log Name: System
Source: Service Control Manager
Event ID: 7042
Task Category: None
Level: Information
Description: The Windows Time service was successfully sent a stop control. The reason specified was: 0x40030011 [Operating System: Network Connectivity (Planned)] Comment: None
A Microsoft support rep pointed me to a Japanese knowledge base article that (with the help of Google Translate) lifts the veil on Windows Time behavior. In Windows 7 and 2008 R2, Windows Time additionally depends on service triggers to determine whether it keeps running.
http://support.microsoft.com/kb/2385818/ja
http://translate.google.com/translate?hl=en&sl=ja&u=http://support.microsoft.com/kb/2385818/ja
Update 22 April 2016 The article is now available in English:
https://support.microsoft.com/en-us/kb/2385818
As you can see by typing
sc qtriggerinfo w32time
Windows Time is stopped if the computer is not domain joined.
I chose their workaround #2, to run Windows Time whenever a network is detected:
sc triggerinfo w32time start/networkon stop/networkoff
Background Research
Here’s the boring background. Skip to the next section for the summary of how to set up Windows Time on a Hyper-V host running a domain controller guest.
At the bottom of the translated Japanese KB article, I saw reference to the Time Synchronization scheduled task. Here we see a task that starts the Time Service once a week. The task_started
parameter apparently tells the service to start, sync the time, and stop.
Let’s compare stand-alone and domain-joined behavior, with the help of this TechNet reference.
In a stand-alone (non-domain-joined) machine, we have this setup for Windows Time:
Type: NTP (uses manual peer)
NtpServer: time.windows.com,0x1 (0x1 means use SpecialPollInterval)
SpecialPollInterval: 604800 in seconds = 7 days
Windows Time is set to Manual start. Even if set to Automatic, Windows Time service trigger stops service because not domain joined.
Windows Time service started once a week by scheduled task, stops after time sync.
On a domain-joined machine, we have this setup for Windows Time:
Type: NT5DS (uses domain controller; NtpServer and SpecialPollInterval have no effect; system determines polling frequency)
MinPollInterval: 10 in Log(2) seconds = 2^10 = 1024 seconds = 17.1 minutes
MaxPollInterval: 15 in Log(2) seconds = 2^15 = 32768 seconds = 546.1 minutes = 9.1 hours
Windows Time service trigger does not stop service; Windows Time always running.
Windows Time service started once a week by scheduled task, ends with 0x420 ERROR_SERVICE_ALREADY_RUNNING.
Set Up Windows Time on a Hyper-V Host Running a Domain Controller Guest
If your Hyper-V host has a domain controller as a guest, here’s how to set up Windows Time. All commands apply to the host.
1. In Hyper-V Server Manager, go to the Settings for your domain controller guest and disable Time Synchronization. (This assumes the domain controller guest is configured properly to sync time with an external source.)
2. Open an administrative command prompt on the host and tell Windows Time to run as long as the network is available:
sc triggerinfo w32time start/networkon stop/networkoff
3. In services.msc, set Windows Time Startup Type to Automatic. Start the service.
4. Still at the command prompt, set Windows Time to retrieve time from the guest:
w32tm /config /manualpeerlist:DC_server_IP_Address,0x8 /syncfromflags:MANUAL
net stop w32time
net start w32time
w32tm /resync
The Results
After running those commands, we hopefully have a server that simulates a domain-joined client:
Type: NTP (uses manual peer)
NtpServer: DC_server_IP_Address,0x8 (0x8 means act as client; system determines polling frequency)
MinPollInterval: 10 in Log(2) seconds = 2^10 = 1024 seconds = 17.1 minutes
MaxPollInterval: 15 in Log(2) seconds = 2^15 = 32768 seconds = 546.1 minutes = 9.1 hours
Windows Time service trigger lets service run when network is connected, so Windows Time always running.
Windows Time service started once a week by scheduled task, ends with 0x420 ERROR_SERVICE_ALREADY_RUNNING.
Update July 25, 2017
On a Server 2016 physical machine, after an in-place upgrade from Server 2012 R2, I’m seeing shorter poll intervals:
Type: NTP (uses manual peer)
NtpServer: DC_server_IP_Address,0x8 (0x8 means act as client; system determines polling frequency)
MinPollInterval: 6 in Log(2) seconds = 2^6 = 64 seconds = 1.1 minutes
MaxPollInterval: 10 in Log(2) seconds = 2^10 = 1024 seconds = 17.1 minutes
Pingback: W32Time Errors in a Hyper-V Virtual Environment | MCB Systems
Thanks for your article!
It did help me!
Thanks for this article, it saved my day
Thanks dude. Very helpful.
Pingback: Check Windows Time Settings | MCB Systems
Pingback: Server 2012 R2 Post-Upgrade Tasks | MCB Systems
An alternative is to delete the triggers so the service always run (e.g. if you want the time to be synced off the host when you are running a Hyper-V guest): http://social.technet.microsoft.com/Forums/windows/en-US/754a5eb4-0f97-43fe-b141-321fa4c015f1/windows-time-startsstops-at-system-startup?forum=w7itpronetworking
Thanks Anon, that does look like a valid solution.
I have a security system that I will be installing shortly consisting of several windows 7 embedded servers running security software as well as several client stations running just windows 7. I am not allowed to connect to the internet/network to get to a time server for accurate time synchronizations so need an alternate method.
I have tried to make the necessary changes to the registry to make one of the servers run as an NTP server. I pointed one of the other servers to it through the internet tab in the windows clock settings. I then adjusted the time to be out by one hour and did an update through the clock internet tab. This appeared to work. I later discovered that if the time was out by 5min or less it would not correct the time right away?? If its was 5 min or more it adjusted right away. Is there a way to correct this? Do you have any suggestions or alternate method to achieve the time sync between these computers on a standalone network?
Thanks, Mark! This is exactly what we were experiencing with several servers in our DMZ. Your information is very appreciated.
I see this article is on the old side, but I thought I would try this. I have been having trouble with my W32time Service. I tried everything (until now) that I could find a solution to my problem. I believe the “The Japanese Secret ” is going to work for me, crossing my fingers.
Thanks for the article and advise!!!