1

We have a server that regularly gets a clock drift problem. It is Windows Server 2012 running as a guest in a HyperV host.

I am under the impression that this scheduled task should periodically cause a re-sync:

\Microsoft\Windows\Time Synchronization\SynchronizeTime

What confuses me is that when I look at the configuration of this task in Task Scheduler, there is nothing listed under Triggers. The Next Run Time column is blank, however the Last Run Time columns shows "16/5/2014 3:24:48 a.m.".

So I know it ran about 5 days ago, but I don't know what triggered it. How is this controlled?

The reason I want to understand this is that I thought I may need to adjust the frequency of this task to something like daily to combat the clock drift.

I don't want to get into a discussion about the best way to sync a server's clock just yet - right now I am specifically asking about the behaviour of this scheduled task.

1 Answer 1

2

Since you explicitly asked for us not to give you advice on how to synchronize time on a Windows machine, I'm going to try to avoid doing that.

The scheduled tasks you see under the Microsoft folder were typically authored by Microsoft, to operate various components of the Windows operating system, and it's not usually a good idea to mess with them.

The scheduled task you pointed out, as you see, simply has no triggers. A scheduled task can be created with no triggers, if you only intend to execute it manually (or call for it to be run from another program.) Most of these scheduled tasks you see that Microsoft added to the OS and that have no triggers coincided with them adding Windows Service triggers to the operating system in Windows 7 and 2008 R2. If you look at the action of that scheduled task, this is what you see:

%windir%\system32\sc.exe start w32time task_started

Notice that the scheduled task passes a command line argument to the w32time service, task_started, to let the program know that it has been started from a scheduled task, as opposed to being started by some other means, such as someone flipping the service on by hand through services.msc. This allows the program to take a different course of action based on how it was started.

If you look at the service triggers for w32time:

C:\Windows\system32>sc qtriggerinfo w32time
[SC] QueryServiceConfig2 SUCCESS

SERVICE_NAME: w32time

        START SERVICE
          DOMAIN JOINED STATUS         : 1ce20aba-9851-4421-9430-1ddeb766e809 [DOMAIN JOINED]
        STOP SERVICE
          DOMAIN JOINED STATUS         : ddaf516e-58c2-4866-9574-c3b615d42ea1 [NOT DOMAIN JOINED]

So does that mean that the Windows Time service only runs when a machine's Active Directory domain status changes? Of course not. That would mean that the millions of standalone PCs in people's homes all across the world that will never join a domain would have no time sync capability, and that is obviously not the case. Windows automatically wakes up the time service and syncs itself all the time... at startup, 1:00AM on Sundays, there are several cases.

The Windows Time service is now trigger-started, and does not run constantly in the background. The idea is to save wasted CPU cycles and battery power on running background services that don't need to be running 24/7. But the catch 22 is that you can't resync time unless the w32time service is running. So how would you automatically start the service, have it sync time, and then shut down again?

I'd set up a scheduled task and call it from somewhere else within the OS.

1
  • Thanks Ryan, you've kinda confirmed my suspicion - the fact that SynchronizeTime appears in Task Scheduler doesn't actually give me any clues as to when or why this task is due to run. May 22, 2014 at 2:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .