As Technet Gallery is retiring so moving the code to Git Hub. (click below github download link for this script)
Hi Readers,
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 = “sukhija@labtest.com”
$from = “ScheduleTask_Monitor@labtest.com”
$smtpserver =”smtp.labtest.com”
Schedule the batch file from task scheduler to run every hour.
Tech Wizard