Sunday, November 22, 2009

Scheduled Task fails: Could not start

I just got a new machine for a customer and started to set it up. I've defined multiple scheduled tasks, and I got: "Could not start" error for one of the tasks... That specific task was a batch job.

I've found few resources on the web and solved the problem. I would recommend the following protocol for such an error:
*. Check the log file of the scheduled tasks: open the scheduled tasks in explorer window and select "Advanced"->"View Log".

Option 1:
*. Check the following policy: Control Panel|Admin Tools|Local Security Policy\Local Policies\User Rights Assignments "Log on as a batch job" (also - someone wrote that his problem was that there was a group policy overriding the local computer policy).

Option 2:
If the error is:
0x80070005: Access is denied.
Try using the Task page Browse button to locate the application.

Try resolving it using the protocol defined here:
*. Check the user you are trying to run as can run the script:
---- Start - Run - RunAs /user:username@domain (Your Command)
*. If it doesn't run, try giving the user privileges:
Cacls c:\windows\system32\cmd.exe /e /g username@domain:r