How can I check a system's current NTP configuration?

Solution 1:

In the command line, type

w32tm /query /configuration
w32tm /query /status
Time /T 

w32tm /query /configuration gives you the configuration you have set up.

w32tm /query /status gives you information such as:

  • stratum
  • leap indicator
  • precision
  • last sync
  • NTP server
  • poll interval

time /T outputs the current system time.

Note: w32tm /query was first made available in the Windows Time client versions of Windows Vista, and Windows Server 2008. See Windows Time Service Tools and Settings

Solution 2:

This answers your last question:

Open a command prompt and type exactly:

w32tm /stripchart /computer:NTPServerNameOrIP /dataonly /samples:x (how many returns you want)

It returns time and difference to NTP server time. If it returns time, error: 0x80072746 then that is not your NTP server.

An example of a command is below:

Command example

Solution 3:

I tried:

w32tm /query /status

I got:

The command /query is unknown.

In a different machine, I got:

The following error occurred: The service has not been started. (0x80070426)

Then I tried:

reg QUERY [\\machine\]HKLM\SYSTEM\CurrentControlSet\Services\W32Time

I got:

ERROR: The system was unable to find the specified registry key or value.

Then I tried:

net time /querysntp

I got:

This computer is not currently configured to use a specific SNTP server.

In another machine, I got the help page, saying also:

The /QUERYSNTP and /SETSNTP options have been deprecated. Please use w32tm.exe to configure the Windows Time Service.

So, basically, the service was not running. Following these instructions, I did:

w32tm /unregister
w32tm /unregister
w32tm /register
net start w32time

Finally, all the above would work. (note: if net start fails, see below) Then I just needed to set my ntp up... I did it with:

w32tm /config /manualpeerlist:10.0.0.5 /syncfromflags:manual /reliable:yes /update

following instructions from here, but perhaps it could've been as easy as:

net time /setsntp:10.0.0.5

as instructed here. (10.0.0.5 being my local NTP server). If you're not using a local NTP server, you can use the generic one:

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:manual /reliable:yes /update

Finally, you might need to do the following, which was not necessary for me:

w32tm /config /update
w32tm /resync /rediscover

NOTE: if net start w32time fails with error 1290 (The service start failed since one or more services in the same process have an incompatible service SID type setting) then follow the steps here:

w32tm /unregister
w32tm /register
sc config w32time type= own
net start w32time

Then follow as above.


NOTE 2: if the NTP service doesn't automatically start on reboot, it might be due to its start settings, as described here: depending on your windows, it might be set to start only when it joins a domain. You can check with:

sc qtriggerinfo w32time

If it's configured to start when you join a domain, and you don't have a domain set up in your machine, it will not start the service and set the time. It probably doesn't join a domain because you don't want it to. In any case, just change which trigger starts it. For example, to start when the machine has network (and therefore is able to access the server), do:

sc triggerinfo w32time start/networkon stop/networkoff

Solution 4:

Use:

net stop w32time
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
net start w32time
w32tm /config /update
w32tm /resync /rediscover

A .bat sample file is at https://gist.github.com/thedom85/dbeb58627adfb3d5c3af.

I also recommend this program: http://www.timesynctool.com/