Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks to all but as the KB fix suggested was simple to test I tried it and it worked a treat. So specific thanks go to Evan. Lifesaver. –  One Monkey Dec 10 '10 at 16:33
    
My psychic powers pay off again... >smile< The first time I ran into this one I was a bit perplexed. That change in permission on CMD.EXE really threw me for a loop. –  Evan Anderson Dec 10 '10 at 17:28

Soudns like your issue is with 7zip itself, I actually have a very similar process setup myself except I am running the scheduled task as a System User with Admin credentials. As FortyPoundHead states the exit codes are going to be very instrumental in resolving this. Also, I would add some logging to your batch file to see where it fails, to see if it receives an error with 7zip etc. Without some kind of logging you are going to have a hrad time troubleshooting this issue.

share|improve this answer
    
+1 for logging, which is so sensible that nobody ever does it. –  jgoldschrafe Dec 10 '10 at 15:32

Are you setting the task to run with correct user credentials? What are the completion codes (Last Run Result) for the task in Task Scheduler? You might see 0x2, 0x40010004, or some such.

share|improve this answer

Charles is dead-on with the logging, but Process Monitor from the Sysinternals suite might be useful for troubleshooting, as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.