I have a Custom Exe/Script sensor that does not send an email notification when in down status. When in a "down" state, the sensor will change to a red/error state in the console, but no email notification to the admin. When the sensor is back to a "up/OK" state a notification email is sent to the admin notifying of the state to "up".
In the code below, "0:OK" works great and sends a notification email and changes status in the console, but the ELSE clause with "2:ERROR" does not send an email only changes status in the console. I am guessing there is something wrong with my exit code in the ELSE clause???
If State = "2" Then WScript.echo "0:OK" WScript.Quit ("0") Else WScript.echo "2:ERROR" WScript.Quit ("2") End If