Windows Scheduled Task Last Result Monitor.
The monitor checks the last result code (exit code) of a scheduled task every minute.
Anything other than ‘0’ is considered a warning condition for an enabled scheduled task.
Use overrides to:
Disable the monitor
Alter the expected return code 'Expected Return Code (RegEx)'. Use a valid regular expression. E.g. ^(0|9|123)$
The process called by the scheduled task failed
Authentication problems of the scheduled task’s user account
Consult the event log of the affected machine and/or Run Scheduled Task
Disable or delete the Scheduled Task
Target | Custom.Windows.ScheduledTask | ||
Parent Monitor | System.Health.AvailabilityState | ||
Category | AvailabilityHealth | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | MatchMonitorHealth | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Custom.Windows.ScheduledTask.DiscoveryData.LastResult.MonitorType | ||
Remotable | False | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Custom.Windows.ScheduledTask.LastResult.Monitor" Accessibility="Public" Enabled="true" Target="Custom.Windows.ScheduledTask" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="false" Priority="Normal" TypeID="Custom.Windows.ScheduledTask.DiscoveryData.LastResult.MonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Custom.Windows.ScheduledTask.LastResult.Monitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="SchTaskLib!Custom.Windows.TaskSchedulerTask"]/TaskName$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="SchTaskLib!Custom.Windows.TaskSchedulerTask"]/TaskLastResult$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="NoFailure" MonitorTypeStateID="NoFailure" HealthState="Success"/>
<OperationalState ID="Failure" MonitorTypeStateID="Failure" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>62</IntervalSeconds>
<BagValue>$Target/Property[Type="SchTaskLib!Custom.Windows.TaskSchedulerTask"]/TaskLastResult$</BagValue>
<DesiredReturnCode>^0$</DesiredReturnCode>
<TaskState>$Target/Property[Type="Custom.Windows.ScheduledTask"]/TaskState$</TaskState>
</Configuration>
</UnitMonitor>