What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

Monitoring Windows System Time Difference to NTP-Server



How can I monitor the time difference between a Windows system and a ntp-server? I would like to do something like: get the time of the target Windows system (maybe by snmp?), then get the time of a specific ntp-server, then calculate the difference in seconds. After that I would like to deploy this sensor for every windows system monitored in prtg.

ntp sntp time

Created on Jul 31, 2018 8:53:52 AM

3 Replies



This is exactly what the SNTP Sensor does :) But it's only available for Probe systems (i.e. either the PRTG server itself or systems that have a remote probe installed).

The following script will actually query the target host and output the timediff to PRTG:

    $ntp = "",
    $target = "",  
    $windowsUserName = "", 
    $windowsPassword = ''

#region configuration section
# parameter im PRTG: -windowsUserName '%windowsuser' -windowsPassword '%windowspassword' -ntp <ntp server> -target <target server>
# create credential object
$secpasswd = ConvertTo-SecureString $windowsPassword -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ($windowsUserName, $secpasswd)


$time_ntp  = (Invoke-Command -ComputerName $ntp -Credential $credentials -ScriptBlock { return (Get-Date) } )
$time_target = (Invoke-Command -ComputerName $target -Credential $credentials -ScriptBlock { return (Get-Date) } )

$diff = New-TimeSpan -Start ($time_dc) -End ($time_opc)

Write-Host ([string]::Format("{0}:Offset between {1} and {2} is at {0} Seconds",($diff.TotalSeconds -replace ",","."),$ntp, $target))

Note that the script requires WMI Permissions as well as a correctly configured PowerShell environment.

Kind regards,
Stephan Linke, Tech Support Team

Created on Jul 31, 2018 11:21:33 AM by  Stephan Linke [Paessler Support]



Thank you, but our ntp-servers don't run on Windows and therefore can't be queried by powershell in the described way. I'm aware of an Windows executable called w32tm which does just that, but I would like to avoid using powershell-remote-calls at all. Our Environment contains roughly 500 monitored Windows systems. It would probably cause a lot of load on the probes when running the sensor this way, won't it? Isn't there another way?

The only two ways I can think of are: - calling w32tm by invoke-command - creating a push-sensor on every Windows system and running a scheduled job on the target systems reguraly providing the time-difference data by using w32tm

I'm just worried about the load on the probes.

Created on Jul 31, 2018 12:21:38 PM



Executing one small script on a host periodically would not increase the load on these. If you're referring to the load caused by the sensors - the HTTP Push Data sensors are really easy on the system. They basically do nothing else than wait for results :) We've recently installed a system with thousands of them with no issues so far.

Kind regards,
Stephan Linke, Tech Support Team

Created on Aug 1, 2018 6:05:38 AM by  Stephan Linke [Paessler Support]

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.