6

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.

2
  • 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, 2010 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. Jun 22, 2010 at 15:27

3 Answers 3

6

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.

2
  • 1
    Actually its "Start in" but thats OK, your answer helped me alot. Thanks and upvote!
    – siniradam
    May 8, 2013 at 11:45
  • Just signed up to upvote it all. "Start in" is located under Actions -> Edit. Feb 23, 2017 at 5:53
0

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?

1
  • 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. Jun 22, 2010 at 15:31
-1

*.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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .