Click an Ad

If you find this blog helpful, please support me by clicking an ad!

Tuesday, March 4, 2014

Alerting for Failed Scheduled Tasks

When I first started setting up my scheduled tasks and automating a lot of things, I had another script that ran every morning to let me know if there was anything that failed.

The downside to doing this was that I wasn't notified WHEN the failure occured, but hours later. A better way to go is to created a scheduled task triggered by a scheduled task failure event, and set the action for that trigger to be to send you an email.

To do this, make a new scheduled task, name it and set the user to run as, and set it to run even when the user is not logged on.

Next, go to the Triggers tab. You are going to make two triggers here.

Trigger One: Begin the task "On an event"
For the Log, drill down to Microsoft-Windows-TaskScheduler/Operational
For the Source, choose TaskScheduler
For the Event ID, choose 103

Trigger Two is going to all the same, except you're going to choose 203 for the event ID.

For the action, choose "Send an e-mail" and fill in your info.
FOR SOME STUPID REASON, beginning in Windows Server 2012 Microsoft has decided to get rid of the "Send an e-mail" action. The easy workaround is to have it run a program, and then call Powershell to run a script that sends the email. :)

No comments:

Post a Comment