How to get the NTP offset and delay values in Windows systems

I've a Linux server where I can get the delay and offset values for a certain peer using the ntpq command:

$ ntpq -nc peers
 remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*162.102.197.46  10.114.18.251    2 u  117 1024  377    0.718    0.360   0.526

I'm using these values in a monitoring script. I also want to take the same values for a NTP peer to which my Windows system is polling, and collate them in my script.

I tried several options for w32tm service, but none is giving me the delay and offset values.

I went through these Microsoft Docs: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/windows-time-service/windows-time-service-tools-and-settings

and found that we can use w32tm with /stripchart and [/rdtsc] option to get these values. But I am not exactly sure how to build the command with the options. I tried several combinations and all give error:

w32tm /stripchart /rdtsc
Required parameter 'computer' missing.
The following error occurred: The parameter is incorrect. (0x80070057)

Can someone help me with the exact command?


Solution 1:

I believe I found one way of doing it:

w32tm /stripchart /computer:hostname.domain /samples:3

The above command give 3 sample values, from which we can take a mean.

where computer:hostname.domain is the peer name (The NTP server that your WIndows system is currently polling) that you find from this command:

w32tm /query /peers