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.

For the life of me, I can't seem to get a batch file running in Server 2008 Task Scheduler, despite it not having the common problems I've seen before.

Problem so far:

  • I have a batch file that takes a hotcopy backup of some repositories and ZIPs them. I am able to run this manually.
  • I have created a task in the task scheduler to call the batch file (no quotes, no command-line args).
  • No matter what, the task returns with Code 0x1 (which I believe has something to do with permissions).

Troubleshooting steps so far:

  • Ran the task manually. Runs perfectly.
  • Made sure I didn't have quotes in arguments due to the 2008 Server hotfix bug outlined previously on ServerFault. I have not only no quoted arguments, but no arguments.
  • Redirected output to a log file to see if it was running. It isn't.
  • Changed the user from the System Service account to the local Administrator account for testing purposes. The Administrator account has all necessary rights & privileges, and is currently logged on when trying to run the task manually.
  • Created another batch file which does nothing but call the other batch file to see if it was somehow maybe a command in the batch file that is initially called. This still fails, but again works if run manually.

I'm at a dead end. Any new thought that could jump-start the troubleshooting process? Thanks!

Edit 1: To clarify, I should note that I'm checking "run task whether user is logged on or not", but I do not remember if it was set up that way initially.

share|improve this question
    
Do you have the check mark for only run if user is logged in? I did that once :( –  Nixphoe Aug 3 '11 at 19:21
    
@Nixpoe: good point. Maybe he should try to recreate the Task from scratch. –  jftuga Aug 3 '11 at 19:30
    
@goober: what do the event logs say? –  jftuga Aug 3 '11 at 19:31
    
@Nixope, I've clarified the question; I have "run whether user is logged on or not" checked, as this is the behavior I wish to achieve. –  SeanKilleen Aug 3 '11 at 19:48
    
@jftuga, I cannot seem to find any associated events in the Event Log after looking through. Is there a specific section you can point to? –  SeanKilleen Aug 3 '11 at 19:48

1 Answer 1

I have the same problem. This is what I checked. What is the name of your batch file? Could it be a .bat? Try renaming it to .cmd SQL Server agent is running the job. Does the service account for that service ha rights? Do you use a call statement or do you just write the name of the batchfile? I think you do not need a call statement (you mentioned it). Is the owner of the job sa. This is normal today. Do you have any net use commands or copy del etc that needs /Q /Y or other statements? The job cannot answer any questions like there are open files are you sure etc. Is there a windows firewall involved? My gotcha was: I tried to do more than one thing in the job. Don't. Rename one thing with one job. Rename another thing with another job. Don't do more than one thing with each job. Sounds stupid I know, but you should do it anyway for troubleshooting purpose. easiest way to test something is net use z: \server\share and see what you get in the event viewer and job history log. Keep it simple then enter a real command. I am very sorry it does not work like it did before when it was top-of-the-line.

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.