Hi Guys,
I am trying to check if a folder is written to in the last 24hr using EXE (i know the folder sensor exists but it will not work in this situation) however i am having issues with the returning value being read correctly by PRTG.
here is the sensor script
$Today = Get-Date $FileList = Get-ChildItem -LiteralPath 'UNCPATH' -File $AgeLimitHours = 24 foreach ($FL_Item in $FileList) { $HoursOld = [math]::Round(($Today - $FL_Item.LastWriteTime).TotalHours, 0) if ($HoursOld -le $AgeLimitHours) { 'value:2' -f $AgeLimitHours } else { 'value:1' } }
This returns: {{{ value:1 value:1 value:1 value:1 value:1 value:2 }} for 6 files over 24hr old and 1 file under 24hrs old. However PRTG only reads 0 as a value. It does however display 1 or 2 directly under the name, as a message?
How can i ensure that the value output is read properly?
Add comment