How to synchronize the pc clock more frequently

Windows' Task SchedulerWindows machines can be set to synchronize their pc clocks with NTP (Network Time Protocol) servers once a week. If your pc is anything like mine, once a week isn’t nearly often enough and it’s easy to forget to do it manually, even though it is both useful and important to have the clock running accurately. Getting Windows to synchronize the pc clock more frequently is surprisingly tricky. So here’s a how-to for Windows 7 and Vista.

First, left-click on the clock in the Windows taskbar and, from the context menu, select Adjust date/time (I am sort of guessing here, I have a Dutch language gui and am unsure about exactly what the English gui says). Select the Internet Time tab and press Change Settings…. In the dialog window that appears next, make sure the Synchronize clock with an internet time server checkbox is checked. IIRC, the server is set by default, but try to find a NTP server nearer to your location (your service provider’s, for instance). The server specified here is used by the task scheduler, which we are accessing next. Click on OK twice to close the respective Date and Time windows.

Click on the Windows Start button to open the Start Menu and in the edit field at the bottom type Task Scheduler (language-dependant) and press Enter to open the Task Scheduler window. Expand the Task Scheduler Library node in the leftmost panel, then expand the Microsoft and the Windows nodes, respectively. Scroll down to the node called Time Synchronization and select it by clicking on it. The center panel will show any task already in this node, and this is where we’ll create a new one. (In fact, it can be created anywhere but if you ever need to make adjustments you’ll know where to find it.)

In the rightmost panel click on Create Task… which should be the second option from above. Enter a Name (mine is Daily Time Synchro) and a Description. Click on Change User or Group and type LOCAL SERVICE in the lower field and click OK. Check Run with highest privileges and select the appropriate Configuration (mine is Windows 7, Server 2008 R2).

Select the Triggers tab and press New…. Select the options you want, my (long-time) settings are On schedule, Daily, 15-3-2011 08:00:00, Recur every 1 days, Enabled. Click OK to close this window and then select the Actions tab. The following steps must be done correctly and in the right order for it to work, so sit up straight and pay attention.

Click on New… on the Actions tab. Select Run a program as the Action and type %windir%\system32\sc.exe in the Program/Script field. In the Add arguments (optional) field type start w32time task_started and click on OK to close the window.

Click again on New… on the Actions tab and select Run a program again as the Action. This time, type %windir%\system32\w32tm.exe in the Program/Script field and add /resync as the argument. Close the window by clicking OK.

Now, go to the Conditions tab and check the Start only if the network connection below is available and select Any connection from the dropdown list.

Finally, go to the Settings tab and check the Run task as soon as possible after a scheduled start is missed. Click OK to save the scheduled task.

Now, test to see if the task you created is working properly. Manually set back the clock a few hours, left-click on the task listed at the top in the center panel of the Task Scheduler and select Run from the context menu. The same context menu allows you to edit all settings, or to delete the task.

And there you have it: a pc clock running accurately all day, every day.

2 thoughts on “How to synchronize the pc clock more frequently

  1. Yes it is Adjust Date/Time, but you need a right click (or double left click) ;-)

    1 thing that might be worth adding, is that the ‘Windows Time’ service needs to be running for this to work (not so with custom code though). And some more aggressive ‘PC Optimizers’ will disable many services, including this one. Likewise with the ‘Task Scheduler’ service…

    And BTW: this all works on WinXP to, not just Vista or 7

    Also, Task Scheduler will not run unless your Windows account has a password (def on XP, not 100% sure about higher). I have a VBScript here, that will enable this:

    I also included a ‘Time Sync’ function in my main SOL toolkit ;-)
    It can cause innacuracies in the SOL client, as it relies on the system clock… (wx for example is computed to the millisecond!)
    Optionally, it can also be done automatically whenever you run it.
    And now I finally have a deployment tech suitable for it, it shall be released quite soon!

    • LOL! Thanks for pointing me in the right direction, Aaron.

      Indeed, that’s why the two actions are needed. The first is to start the Windows Time service if necessary, the second action does the synchronizing. I didn’t know about optimizers disabling the Task Schedulder, so that’s something to keep an eye on.

      At least on (my) Windows 7 machines, if running this as a local service you need not enter a user password, otherwise UAC will ask for a password upon closing the action tab.


Comments are closed.