Why isn’t the Scheduled Task running a batch script

batch-filescheduled-taskuser-accountswindows-server-2003

OS: Windows 2003 Server

Setup: The batch file basically uses 7zip to zip up a few files into a location ready for uploading into an offsite location via FTP. I have run the batch file as myself and it has worked perfectly. It takes about two hours to zip the files.

I have applied full permissions on the relevant folders to the user account (a non-System user account that I created for this job) that will be performing the scheduled task. I have set the batch file to be runnable by non-administrators. I have made sure that the user has access to all relevant folders and files and is allowed to run 7Zip. I have given the user account permission to read and execute the scheduled task.

Symptoms: If I right-click the Scheduled Task and select Run three events appear in the Security log showing the User is logging in, and then almost instantly logging out. No other exceptions or errors appear. The expected DOS window does not even flicker into my field of vision. If I run the batch manually then the date accessed on 7zip updates with when the batch started running. When the scheduled task is selected to run it doesn't.

What am I doing wrong?

Best Answer

I wonder if you aren't running into the problem of CMD.EXE not being readable by non-Administrator users when not running as "INTERACTIVE" (or "BATCH" or "SERVICE"). This is a a new default in Windows Server 2003. Take a look at this Microsoft KB article for some details.