Hi, i have a powershell script that returns two values "OK!" and "Failure". How can i now use it in the PRTG EXE/script sensor?
$dir = "myDirectory" $filter = "*.log" $searchstring = "Status" $latestfile = Get-ChildItem -Path $dir -Filter $filter | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $lastlines = Get-Content -Path $latestfile.FullName -Tail 5 $sel = $lastlines | select-string -pattern $searchstring If ($sel -eq $null) { Write-Host "Failure" Exit 2 } Else { Write-Host "OK!" Exit 0 }
Thanks
Add comment