\Tips and TricksSchedule Tips
Windows tasks
(as created with the MAKEMSI "schedule" command) are stored
as ".job" files in the "%systemroot%\tasks" directory.
A schedule can not be installed in Windows 95, 98 or
ME for this reason it is suggested that a launch condition be created to
display a message if the user is running these operating systems.
Some Debugging Tips #1 - Can't Even Create the Schedule! |
- Double check that the task scheduler service is running
(and certainly not disabled).
You can check this with the "Services Applet".
- I have found that there is a length (and possibly content) limit
to whats valid in the "comment" (and possibly other ) field,
simplify things until you have worked out where
the issue is. It can help to copy/paste the command line from the log
file and create a batch file so you can quickly try many variations.
Some Debugging Tips #2 - Schedule Execution and Options |
- Only a subset of the available options are exposed in the Windows GUI.
- The scheduler creates a log file which may indicate the reason for
any failure for a trigger/schedule to start (and logs the return code).
Its probably called "SchedLgU.Txt" and although I've seen it in the
the "%systemroot%\tasks" directory on WIN2003 server (won't be visible in explorer),
I've mainly seen it in the "%systemroot%" ("C:\WINNT" or "C:\WINDOWS") directory.
Note that the latest message is probably not at the end of the file
(look for "most recent entry is above this line")!
- If the schedule never kicks off (and no log see above) then
double check that the task scheduler service is running
(and certainly not disabled).
You can check this with the "Services Applet".
- Be careful with "KillAtDuration", if your schedule terminates
straight away or doesn't seem to complete then check the log file
windows creates in the windows directory to see if the windows
scheduler killed it, then check the parameters you used on the trigger that
fired (particularly if it works OK when manually invoked).
- When you right click and select "run" you are not using the
schedules credentials or proving that any of the triggers work.
You can thank MS for this (and I suspect you will have cause to).
- The only way to prove a trigger is to have it trigger itself.
This way you are testing the many trigger specific options such as
duration and repeating.
- If a schedule's trigger starts the task then the schedules
userid/password (or SYSTEM account) as configured is always used,
even when run at user logon.
If however you manually invoke it in any way your userid is
used!
- If a trigger fails, check the log but it could be security related,
if so you may need to check account permissions/policies with the
local security settings applet.
An example of a log entry is:
"MyJob-EarlyEveryMorning.job" (cmd.exe) 5/02/2006 5:30:00 AM ** ERROR **
The attempt to log on to the account associated with the task failed, therefore, the task did not run.
The specific error is:
0x80070569: Logon failure: the user has not been granted the requested logon type at this computer.
Verify that the task's Run-as name and password are valid and try again.
- If a trigger works for a bit (particularly after creating the trigger)
then fails then you could have active directory modifying the
security policies mentioned above (so check them again)!