Compartilhar via


How to troubleshoot Scheduled Tasks that fail to run

Frequently a Scheduled Task fails to execute and you need to identify why it stopped working. Or it may have never worked correctly and now is the time to fix it! :)

The first thing I do is check the Events in the History Tab. Both the Successful and Failed runs of this Task will be logged here as Events.

You can even save these events as an .evtx file which can then be opened by the Eventviewer tool:

The event id of the problematic Task will usually give you good hints about the root cause of the failure.

The next thing I like to check is the conditions under which this Task fails to run. To do this, I prefer to directly check the XML file of the Task. First I export the Task as an XML file:

Then I review the conditions inside the files and check which could apply in my specific scenario:

<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>

You could also use this exported XML file to import the Task at another server where you want it to be executed.

If you have found better ways to troubleshoot failed Tasks please let me know! You are never too old to learn new tricks :)