Schedule Task to Start When Another Task Finishes

In Windows Task Scheduler, you can run tasks both on the schedule and after the specific event is registered in the log. (It has been described in the article “Event Triggers in Windows“.) In this article we’ll consider how to automatically start a Scheduler task after the previous task is completed. Let’s take a look at the algorithm to configure dependencies of running Scheduler tasks, which you can customize to meet your needs.

In my case, after one script had been completed I had to start another script from another user account. So these actions could not be united in a single task.

Suppose, we have to start the Pong Scheduler task after the Ping task is completed. When any task is started or completed, the information about this event is registered in the system log. We’ll focus on the event of Ping task completion.

Open TaskScheduler console (Taskschd.msc), locate and select Ping event, and in the bottom panel go to the History tab, which contains the information about all events associated with this task. We need the event with the Event ID 102 (Task completed) which is generated after the task is completed.

Open the detailed event description by going to the Detail tab and enable the XML View of the event. According to the XML data, you can get all details of the event necessary to create a filter. In particular, we need:

When creating a trigger for the Pong task, we have to create a trigger condition for the task to start when the event with the ID 102 appears in the log (Task trigger On an event). But the problem is that EventID 102 appears after any task is completed, not only the Ping task.

However, it is possible to create a more flexible condition for event selection (Custom) if a standard filter does not help to select the event accurately enough. Click New Event Filter:

Create a new event filter by specifying the data from the XML View of the event:

Events Logs: Microsoft-Windows-TaskScheduler/Operational

Event source: TaskScheduler

Task category: Task completed

Then go to the XML tab and have a look at the following filter view (XPath):