drew
drew

Reputation: 319

Windows Task Scheduler Event ID

I was looking to see if there was an event id I can listen for when a windows scheduled task ends. I created a task that listens for when a windows log event happens. I just need a windows event id that is reliable to listen for. 110 happens when one starts but I need something for when it ends. If it is successful there is a 102, but if it fails, there could be a bunch of numbers that show up. I didn't know if there was a task finished regardless of what happened ID.

Or if anyone knows of a better solution on how to monitor scheduled tasks in real time that would be great.

Upvotes: 2

Views: 20260

Answers (1)

Vesper
Vesper

Reputation: 18747

Here are all possible codes of task scheduler events. There is a 102 for total success, a 111 for task running too long, 202 and 203 regarding individual actions in the task (you might want to watch for these), and 323, 327, 328, 329, 330 for various termination reasons (on battery, not idle, etc). Each of these events designate a task termination, maybe with exception of 202 and 203 as they might be triggering on each action separately. You should register a listener for all of these events in order to monitor the completion of Task Scheduler tasks.

Also, to my knowledge, if an action returned an error but otherwise terminated normally, the task manager reported a "success" event (102) and an error code to parse. So any event but 102 and 111 should be signs of malfunction on the task scheduler side. Still, it'll be better to listen for events 111 just in case some of your tasks would hang.

Upvotes: 1

Related Questions