Windows – How to manually trigger the first sync for ‘Internet Time’ in Windows

timewindowswindows-server-2012windows-server-2012-r2

When launching a Windows Instance on AWS I'd like to trigger the "Internet Time" to be updated via the command line (powershell or cmd).

If I go to "Adjust date/time" and select the "Internet Time" tab I see "This computer is set to automatically synchronize on a scheduled basis."

The problem is that when I inspect the event log I see that the server never actually attempts to synchronize the time.

If I click on "Change Settings" and click the "Update now" button the text changes to:
"Next synchronization: 1/1/2015 at 9:00 AM"
"The clock was successfully synchronized with time-a.nist.gov on 1/1/2015 at 7:00 AM."

After this process I can see in the event log that the time is synchronized each night and the text in the UI gets updated accordingly.

I'd like to find the shell command that initiates this process so I can fire it the first time when the server is setup.

Thanks in advance to any suggestions!

Best Answer

Just stop and restart the time service net stop w32time then net start w32time.

Regarding Reaces suggestion, I can't recall if that works or not on first go/change when setting up NTP. If it does, good deal. You'd use w32tm /resync /nowait if that's the case but for some reason I thought I had to restart the time service.