As Technet Gallery is retiring so moving the code to Git Hub. (click below github download link for this script)
We have created a new script which was required by our backup team. They had below requirements:
- Montor Task Scheduler for failed tasks
- Send email if the task is failed.
- Send the error as attachement
- Send the server name in message subject
- Only monitor tasks that have name snapshot or backup
- Updated 02/28/2014 — to cover the tasks that run for hours
- Updated so that multiple emails for same alert are not received.
So download the attached solution, extract it.
Enter the server names in servers.txt file.
Change the variables accordingly
$hours = “-720” (-720 ensures if the task is running for some hours than also it is covered, you can increse this value upto -1440)
$matching1 = “snapshot”
$matching2 = “backup”
$email1 = “firstname.lastname@example.org”
$from = “ScheduleTask_Monitor@labtest.com”
Schedule the batch file from task scheduler to run every hour.