Alert with PowerShell output

Hello everyone,

I am trying to run a tool (powershell) every 5 minutes on a server and send an email with the powershell output, but I can’t figure out how to append the script output into the alert message body (email action in my case)

Also, the alert triggers just once based on zero return of the script. How to I re-arm it to run every 5 minutes?

Any ideas ?

Thanks

Hi,

Sounds similar to what I was also trying to do this week

I wanted my toolbox item (ps script) to trigger daily and the return code is zero. I setup an alarm with the toolbox item as the trigge, set the schedule and initially set it to look for zero but this would only trigger once. The problem with this was that there was no action to reset it (ie ps script returns 1) so it would never trigger again.

I actually changed the initial trigger to look for return code NOT zero. Which means it runs on the schedule but does not actually trigger an alert or flag on the machine. It then keeps repeating as per the schedule as required. It seemed a little counter intuitive but have been tested it running every 30 minutes over a bunch of test machines for a few days and now working as I need.

Hopefully it works for you

1 Like