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.

I have several tasks in Task Scheduler in Windows Server 2008 SP2 (32-bit) and they all successfully "do their work", except for creating or updating any files on Windows. All the tasks point to simple .cmd files that have the real work but beyond that there's no pattern: some call robocopy with the /LOG option, some call .exe files I wrote that manipulate XML files, some just do stuff with > redirection.

With all of them, if I double-click the .cmd file myself, it works fine and the files are created or updated or whatever. If I run it from Task Scheduler (by the schedule or just clicking Run), the task always completes "successfully" but without any of the desired changes to files. I don't see any "unable to create file" errors in Event Viewer either.

The tasks do all Run As a specific account, but I have logged in as that account and verified that it has permissions to do everything it needs to.

Further details -- Task is set to Run whether user is logged in or not. Configured for: "Windows Vista or Windows Server 2008", there is no other Configured for option available.

share|improve this question
    
So when you log into the account responsible for these scheduled tasks you can click the ".cmd files" it properly executes and creates the files. Though when the task itself executes under the same user the files are not created? Are you sure you are allowing the task to run even if the user in question is not logged in? –  Campo Jun 21 '10 at 19:50
    
That's right. It's weird tho, it's not like everything to do with file creation/editing/deletion isn't working. For example, a couple of .cmd scripts make a bunch of calls to Robocopy; the copies always work fine even when running as a scheduled task - but the /LOG:file option only creates/updates the log file when I run the .cmd myself, not when Task Scheduler runs it. –  East of Nowhere Jun 22 '10 at 15:27

3 Answers 3

up vote 3 down vote accepted

One thing to note is where the script is running from. If you have a patch file that say references "test.log", running the batch directly from c:\logs will have no problems. But when task scheduler runs it it wont know where to find "test.log". So make sure that you either use full paths in your code, or you use the "Run in" function of task scheduler.

share|improve this answer
    
Actually its "Start in" but thats OK, your answer helped me alot. Thanks and upvote! –  siniradam May 8 '13 at 11:45

What configuration do you have for your tasks? I've had similar issues with cmd executed scripts if they were configured for 2008. On the general tab, I've had to set the "Configured for" option to 2003/xp/2000. What options do you have for security options?

share|improve this answer
    
I don't have an option to configure for 2003/xp/2000. Did you ever find out why it wouldn't work if configured for 2008 - is there some other way I'm supposed to manipulate files automatically in Windows Server 2008, outside of Task Scheduler?? I really wouldn't know what security options to look for. The account that all the scheduled tasks Run As is in the Administrators group. –  East of Nowhere Jun 22 '10 at 15:31

*.exe files when run through schedule task; though appears completed successfully the task remains undone! but when the *.exe file is called via schedule task using batch file the task is done, Is this the only way to run *.exe file in server 2008?

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.