This is a SAM component monitor that checks a Windows node's time skew against a specified NTP server.
The script is a modified and extended version of the SAM Template found here: https://thwack.solarwinds.com/docs/DOC-147721 - this version varies from the original in the following ways:
- adds 'Statistic.Message' property for queries
- adds multiple try/catch blocks to account for common failure scenarios
- attempts fallback of 'Get-WmiObject' queries that generated exception when run against a local computer by running without 'Credential' parameter
- returns a null statistic, unique exit code, and unique error message for each failure scenario to aid in troubleshooting failures
Note: exit codes are intentionally greater than 3 so that component is marked with status 'Unknown' rather than 'Down'