How do i get the respons back to prtg to set the monitor to red if the valviu is "Files are different" and to grren when the valviu is "Files are the same"

$SourceDocs = Get-ChildItem –Path C:\Temp\EXE\am0ytil.exe | foreach {Get-FileHash –Path $_.FullName} $DestDocs = Get-ChildItem –Path C:\Temp\EXE1\am0ytil.exe | foreach {Get-FileHash –Path $_.FullName}

if(compare-object ($SourceDocs.Hash) ($DestDocs.Hash)){ Write-Host 'Files are different "2"' -fore red }else{ Write-Host 'Files are the same "0"' -fore green }


Article Comments

Hi there,

The output must match the format that PRTG expects.
Just to check, did you already review PRTG's File sensor which might suit your requirements here as well?

Best regards,
Sebastian


May, 2019 - Permalink