I have the following PS-Script which works well:
$sb = { if (!(get-process 'LogikWebserver').Responding) { write-host "1:Not Responding" ; exit 1 } else { write-host "0:OK" ; exit 0 }} $File = "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\AdminSystem.txt" [Byte[]] $key = (1..16) $pw = Get-Content $File | ConvertTo-SecureString -Key $key $admin = "domain\admin" $cred = New-Object System.Management.Automation.PSCredential -argumentlist $admin,$pw Invoke-Command -scriptblock $sb -computername COMP -credential $cred
I now want to set the status of my sensor to "error" when my script returns "Not Responding", and I want it to send me an E-Mail.
I know how to send an E-Mail directly from the script, but I'd rather have a PRTG-Mail just with my status code. How do I do that?
Thanks!
Add comment