Introduction
Microsoft's Task Scheduler comes preinstalled with your Windows system. You can find it in the Control Panel.
Using the Task Scheduler, you can schedule a variety of tasks and system tools. Nearly any application or script (batch file) can be scheduled to run daily, weekly, monthly or at certain times (i.e. on system boot, user logon or system idle). The Task Scheduler automatically launches when you start Windows, and runs in the background.
The Task Scheduler writes its status information to a log file called SchedLogU.txt. This file is located in the %WINDOWSDIR%\Tasks directory.
IMPORTANT NOTE: The %WINDOWSDIR%\Tasks is a hidden system directory, and is not listed by the Windows Explorer by default.
How to use ActiveXperts' Scheduled Task check
ActiveXperts' Scheduled Task check reads its information from the %WINDIR%\Tasks\SchedLogU.txt file. It tries to match a particular job that finished today, and determines if it completed successfully or not.
Let's take a look at a snapshot of the SchedLogU.txt log file on a server called Server05:
"Task Scheduler Service" Exited at 27-9-2006 14:45:31 "Task Scheduler Service" Started at 27-9-2006 14:48:07 "Task Scheduler Service" 5.2.3790.1830 (srv03_sp1_rtm.050324-1447) "Task Scheduler Service" Exited at 27-9-2006 16:27:50 "Task Scheduler Service" Started at 27-9-2006 16:30:32 "Task Scheduler Service" 5.2.3790.1830 (srv03_sp1_rtm.050324-1447) "AxRgCmd.job" (f today_summary_xml.rep) 28-9-2006 19:58:00 ** ERROR ** The attempt to log on to the account associated with the task failed, therefore, the task did not run. The specific error is: 0x80070533: Logon failure: account currently disabled. Verify that the task's Run-as name and password are valid and try again. "TodayDetailed.job" (TodayDetailed.cmd) 28-9-2006 20:33:00 ** ERROR ** The attempt to log on to the account associated with the task failed, therefore, the task did not run. The specific error is: 0x80070533: Logon failure: account currently disabled. Verify that the task's Run-as name and password are valid and try again. "today_summary_xml.job" (today_summary_xml.cmd) 29-9-2006 9:31:00 ** ERROR ** The attempt to log on to the account associated with the task failed, therefore, the task did not run. The specific error is: 0x80070533: Logon failure: account currently disabled. Verify that the task's Run-as name and password are valid and try again. "myjob.job" (myjob.bat) Started 29-9-2006 12:35:00 "myjob.job" (myjob.bat) Finished 29-9-2006 12:35:00 Result: The task completed with an exit code of (0).
To check if myjob.bat has completed successfully, you must configure the check as follows:
(Click on the picture to enlarge)
In the above picture, the following fields are used:
Scheduled Task Log File
This must be a UNC path to the Scheduled Tasks Log File on the (remote) server. A UNC path consists of a server name, followed by a path, formatted like this: \\server\path.
By default, the Scheduled Tasks Log File is called SchedLogU.txt and is located in the %WINDOWSDIR%\Tasks directory.
In the above sample, we want to monitor a scheduled task on server Server05, so a valid log file location would be: \\Server05\C$\Windows\Tasks\SchedLgU.txt.
NOTE: You can use the 'Browse' button to locate the Scheduled Tasks Log File in the %WINDOWSDIR%\Tasks, but keep in mind that this directory is a hidden system directory, and is not listed by the 'Browse' dialog by default.
Job Name
This can be any word used in any line that starts with ". The " character at the beginning of a line indicates another job in the log file. In the above sample, myjob.bat is entered in the 'Job name' field, but myjob.job can also be used (see also the log file in the snapshot above).
Completed keyword
On English Windows operating system, the 'Finished' keyword indicates that a job has completed (no matter if it was successfull or not). To monitor Scheduled Tasks on Windows operating systems with a different language, you should enter the translated word for 'Finished'.
Today's date formatted as
The Scheduled Tasks check checks for jobs completed today. The format of a date can be different amongst your network servers. ActiveXperts Network Monitor searches in the Scheduled Log file for jobs that have completed today. In order to search for the right date, the format of the date for the particular server is required.
Match the following pattern / If pattern is matched, the result is...
When ActiveXperts Network Monitor finds the particular job, it tries to match the contents of that job entry to a pre-defined string.
Let's take a look at the log file snap shot and screen capture, and imagine that today is 9/29/2006. The Network Monitor engine find the following job:
"myjob.job" (myjob.bat) Finished 29-9-2006 12:35:00 Result: The task completed with an exit code of (0).
It will now try to match string 'Result: The task completed with an exit code of (0)' with the contents above. The pattern is matched, and since 'If pattern is matched, the result is...' is set to 'Success', the final result of the check is: Success.