Windows Scheduled Task

We run lots of batch processes overnight. We do this to send emails, to generate reports, etc… We do all this via Windows Scheduled Tasks. It works great.

Recently, I needed to add a new scheduled task.  I went through the process of adding the task but when I tried to run it, it failed.  The error message I got was “Could not start task

What?  I’m an admin on the box aren’t I?  What’s going on here?  Just in case, we set up a new user specifically to run the task.  No luck.  ARG.

I did some digging and found that we can view the log of scheduled tasks.  That might help.  To access the scheduled task log, click on Advanced > View Log.

This revealed my error message.

"MajorsDB Notifications.job" (MajorsDB_Batch.exe notifications) 2/9/2011 10:00:00 PM ** ERROR **
 Unable to start task.
 The specific error is:
 0x80070005: Access is denied.
 Try using the Task page Browse button to locate the application.

Okay… well, so what?  I know I have rights to the executable and to the directory.  I can run the program interactively.  What’s going on here?

I did some searching and found that CMD.exe (which is used to run the scheduled tasks) is blocked if users aren’t specifically logged in.  Aw, come on man!

The simple way to fix this is to write a batch file to run the program.  So before, I was trying to run the executable directly.

I had to write a batch file to run the program and then I could set the task to run that.

Now the task runs as a batch file (which runs the executable).  All is well again!

Scroll To Top