Task Scheduller jobs monitor

RaavanSuraj 6 Reputation points
2021-07-02T14:32:29.43+00:00

Hi Everyone,

I have a Development server(For example GFDKGNKD ) in that ,I have more than 50 TASK SCHEDULER jobs run every day ,Need to monitor jobs status like fail or success .If any job fails needs to get email notification to the users about the failed job. Is there any PowerShell script to monitor fail jobs and email notification sending ?

Appreciate your help

Thank you

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,344 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 44,456 Reputation points
    2021-07-02T15:20:39.077+00:00

    You can use the Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets for this:

    $x = Get-ScheduledTask | Get-ScheduledTaskInfo
    

    For each task you'll get an object with these properties:

    LastRunTime        : 7/2/2021 10:53:53 AM
    LastTaskResult     : 0
    NextRunTime        : 7/2/2021 5:00:00 PM
    NumberOfMissedRuns : 0
    TaskName           : Adobe Acrobat Update Task
    TaskPath           : \
    PSComputerName     :
    
    0 comments No comments