Dave P
Dave P

Reputation: 121

Windows Scheduled Task, Detecting Failure Programmatically

I'd like to develop a monitor to detect failed scheduled tasks and tasks that have run for over 'x' minutes. I'm looking for ideas to probe status of tasks and detect a failure code (or receive a status of running). I'd also like to verify the "stop running after 'x' hours" setting.

Upvotes: 1

Views: 538

Answers (1)

Mark Ransom
Mark Ransom

Reputation: 308166

Have the scheduled task log its start time, end time, and end status in a database. All you need to do is query for the latest entries in the start and end tables to know the current status. As a bonus it gives you a history.

Upvotes: 1

Related Questions