Hello all I have the following powershell script:
$message = "OK" $urbackuphost = "ics-urbackup.ad.icsanalytics.com" $count = Invoke-Command -ComputerName $urbackuphost -ScriptBlock { Invoke-SQliteQuery -Query "select count() from clients WHERE lastbackup_image < datetime('now', '-1 hours')" -DataSource "C:\Program Files\UrBackupServer\urbackup\backup_server.db" | ConvertTo-Csv | select -skip 2 } if ($count -gt 0){ $message = "ERROR" } #$count = 0 Write-Host $count":"$message
Essentially I query a sqlite database table to see if some items are past a certain date and to count them. When I run the powershell script locally on the PRTG machine it returns the values and the write-host message as expected.
For instance the script as it sits right now ran at the time of post would result in a write-host output of
7:ERROR
However my sensor displays 0.
If I uncomment out the line that starts with #$count and set the value to $count manually to ANY number. It will correctly display in the sensor. I thought this was maybe something to do with integers vs strings, but I've converted $count to integer and vice versa and nothing seems to work.
Add comment