Recipe 10.15. Troubleshooting Scheduled Tasks


Problem

You want to determine why a scheduled task is not running.

Solution

There are three places you can check to help determine why a task is not running:

  1. Open the Scheduled Tasks applet. By default, the applet displays columns for Next Run Time, Last Run Time, Status, and Last Result for each scheduled task. Here you can see when the task was last run and if it generated an error. If there is anything other than 0 x 0 for Last Result, an error of some type occurred. This doesn't necessarily mean the task didn't complete, but some error was identified.

  2. Ensure that the Task Scheduler Service is running. You can do this by opening the Services snap-in (services.msc) and looking at the Status column for Task Scheduler. It should have a status of Started. Alternatively, you can run the following command:

    > sc query schedule

  3. Open the Scheduled Tasks log file located at %SystemRoot%\Schedlgu.txt. This log file is written to every time a scheduled task starts and finishes. It can provide useful information about when a task was run and what errors there were, if any. This is helpful because, unlike the Scheduled Tasks applet, this shows the start and finish times every time the task was run, instead of just the most recent time.

Discussion

A good test of the configuration of a task is to run it once manually. You can do this by right-clicking the task in the Scheduled Tasks applet and selecting Run. If everything works ok, make sure the task is enabled by double-clicking the task and making sure the checkbox beside Enabled is checked. If it is checked, make sure the time in the Next Run Time column in the Scheduled Tasks applet is what you think it should be.

One thing to note about the Schedlgu.txt log file is that by default it will only grow to 32 KB in size. Once it reaches that size, it will start overwriting the beginning of the file. You can increase the max size by setting the following Registry value:

Key: HKEY_LOCAL_MACHINE\Software\Microsoft\SchedulingAgent Value Name: MaxLogSizeKB Value Type: REG_DWORD Value Data: <SizeInKiloBytes>

Replace <SizeInKiloBytes> with the maximum size you want the log file to grow to. The default value is 32. Restart the Task Scheduler service after setting the value.

See Also

MS KB 169443, "How to Limit the Maximum Size of the Scheduled Tasks Log File," and MS KB 308558, "HOW TO: Troubleshoot Scheduled Tasks in Windows XP"



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net