I've created a Windows PowerShell Monitor that calls w32tm to check time source. My goal is to setup alerting if a server is using Free-running System Clock.
$time = w32tm /query /source /computer:${IP}
If ($time -eq 'Free-running System Clock')
{
Write-host "Message:" $time;
Write-host "Statistic: 1";
Exit 1;
}
else
{
Write-host "Message:" $time;
Write-host "Statistic: 0";
Exit 0;
}
It works when pointed directly at the SolarWinds server itself, but won't work against anything else. The script works fine within PowerShell after PowerShell has been launched using credentials with appropriate access to the target computer, but I get an "access denied" message when testing within SolarWinds. How do I tell SolarWinds which credentials to use in this scenario?