Schedule Task Monitor Script

As Technet Gallery is retiring so moving the code to Git Hub. (click below github download link for this script)

Schedule Task Monitor 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.

Capture

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

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Cheat Book

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s