Windows Time Skew

This script attempts to discover the time skew of a remote Windows server to an accuracy of 1 second, by running a PowerShell script on the poller. The NTP server name or IP should be entered in to the Script Arguments in SolarWinds.
  • I have uploaded a reworked version of this script that handles a few of the issues we experienced in our environment.  Specifically:

    • retries the Get-WmiObject query when a previous one generated an exception for local computers (this should allow checking of SolarWinds pollers and domain controllers)
    • adds multiple try/catch blocks to handle various error conditions
    • adds a unique statistic message for each code result (including all failures) allowing for easier troubleshooting

    The script can be found here (PowerShell - Windows Time Skew ) - note, this is the Powershell script to add to the check, not the full template.

  • Having some troubles with the template. No matter what values I put, it always reports as down. I have done a winrm qc on the server I want to monitor, but not sure if thats all that needs to be done. Any suggestions/ideas?

  • This is fantastic!  I'm curious though, what would it take to monitor NTP services from an infrastructure perspective?

    I ask because this template will help me detect time syn issues on affected systems, but what about one that catches the root cause (ie. infrastructure side)?  It would prevent me from having to put the same monitor on multiple applications.

  • Thank you for this script!  I've had this deployed on some critical servers for a few months now and it's been working well.  Over the past few weeks, the script has returned a 16 seemingly at random.  Consequently, the component is reports as down.  Nothing else is out of the ordinary on the affected servers.  Any insight would be appreciated!

  • Dear, I tried on a node with the same credentials both as local domain to use correctly in other nodes but this still gives me this error :

    This node is a pooler too

    Testing on node SNDPE6: failed with 'Down' status.

    Output:      ==============================================

    Unable to Get-WmiObject Win32_UTCTime

    Errors:      ==============================================

    Get-WmiObject : User credentials cannot be used for local connections

    At line:31 char:38

    +     $remoteServerTime = Get-WmiObject <<<<  Win32_UTCTime -ComputerName '10.161.X.X' -Credential 'administrator@anything.com'

        + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException

        + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    Get-Date : Cannot validate argument on parameter 'Year'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.

    At line:37 char:66

    +     $remoteToSolarSkew = New-TimeSpan $localTime $(Get-Date -year <<<<  $remoteServerTime.Year -month $remoteServerTime.Month -day $remoteServerTime.Day -hour $remoteServerTime.Hour -minute $remoteServerTime.Minute -second $remoteServerTime.Second)

        + CategoryInfo          : InvalidData: (:) [Get-Date], ParameterBindingValidationException

        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetDateCommand

    New-TimeSpan : Cannot bind parameter 'End' to the target. Exception setting "End": "Object reference not set to an instance of an object."

    At line:37 char:38

    +     $remoteToSolarSkew = New-TimeSpan <<<<  $localTime $(Get-Date -year $remoteServerTime.Year -month $remoteServerTime.Month -day $remoteServerTime.Day -hour $remoteServerTime.Hour -minute $remoteServerTime.Minute -second $remoteServerTime.Second)

        + CategoryInfo          : WriteError: (:) [New-TimeSpan], ParameterBindingException

        + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.NewTimeSpanCommand

    Can somebody help me?