Is there a "portable" way across recent (this millennium) versions of Windows for forcing an NTP synchronisation?
On Windows 7, there are even prerequisites - the service
Windows Time needs to be running.
(Click the time in the taskbar → Change date and time settings... → select tab Internet time → Change settings → tick Synchronize... checkbox. This will start the
Windows Time service).
After that, from an elevated command prompt, I can do:
> w32tm /resync Sending resync command to local computer The command completed successfully. >
... but I don't think that's backward compatible. The documented way for Windows XP uses
> net time /setsntp
...but on Windows 7 this gives the error message:
The /QUERYSNTP and /SETSNTP options have been deprecated. Please use w32tm.exe to configure the Windows Time Service.
So, is there a way to make this happen regardless of Windows version? (If it can't be done in a simple command, then maybe programmatically?)