Monitor Scheduled Task Failures

I wanted to share this small code which I have originally found on internet, modified a bit to work for us.

I am also including the function Get-FailedScheduledTasks inside latest vsadmin module which is getting very good response from the community

as it includes all day-to-day scripts used by system administrators in the form of commands.

Download it from Gitlab or PowerShell Gallery:

https://github.com/VikasSukhija/Downloads

getfailedscheduledtasks.ps1

https://www.powershellgallery.com/packages/getfailedscheduledtasks

Install-Script -Name getfailedscheduledtasks

Now just update the variables and below lines:


$getFailedScheduledTasks = Get-FailedScheduledTasks -includepaths “Scheduled”,”DevSolutions”

Update the TaskPath Names to input parameter include paths.

Now just schedule the solution from task scheduler, when it runs, it will check which task has failed and will send email alert on designated email id.


You can either use this script or vsadmin module to achieve the monitoring.

 

Thanks for reading …

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

Advertisement

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 )

Facebook photo

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

Connecting to %s