Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way I can synchronize the system clock with an Internet Time server (i.e: via command-line? Preferably, this should be something executable via BAT or PowerShell script.

This particular need arises because I have some VMs for which I regularly use the "save machine state" function, and these don't typically re-synchronize their clocks when I "wake" them. Often times, I'll re-load them to find the clock is (and is staying) days out-of-synch.

Re-synching the clock through the Internet Time Settings dialog usually works fine, but it takes a lot of mouse-clicking to do this. I'd much rather just keep a script on the desktop that I can double-click and have the job done for me.

Right now this is for a system running Windows 7 Home x64, but backward-compatibility to XP SP3 would be nice to have.

share|improve this question
Most VM software (Virtual PC, VirtualBox) comes with drivers ("Additions") that keep the guest's clock in sync with host, among other things. – grawity Aug 15 '11 at 20:46
@grawity - Using those, but it doesn't seem to do the job. – Iszi Aug 15 '11 at 21:08
up vote 11 down vote accepted

See the reference for W32tm, "A tool used to diagnose problems occurring with Windows Time": Also, w32tm /?

Use w32tm /resync. You may also need to set a server with net time if you haven't done that yet.

share|improve this answer
Okay, I did... @echo off && w32tm /resync && PAUSE Threw that in a BAT file, and set a shortcut on the desktop with "Run as administrator" checked. Thanks! – Iszi Aug 15 '11 at 21:09
On Windows 7, when I do this I get: The following error occurred: The service has not been started. – User Feb 12 '13 at 0:33
@echo off && w32tm/resync - Command propmpt says that it does not recognize command (w32tm) – Arpit Parekh Oct 3 '14 at 18:01
.. The command I could not run on windows 7. – Arpit Parekh Oct 3 '14 at 18:12
@Iszi My mistake, actually I just have to select command prompt as Run as administrator. The command is working very fine. Thanks – Arpit Parekh Oct 3 '14 at 18:43

I used to do it with the net command.

for ntp

net time

for windows

net time \\server

I can't recall if you needed some sort of /ntp flag for the ntp... it will tell you if you do.

share|improve this answer

You must log in to answer this question.

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