Scheduled Task unable to create/update any files

task-scheduler

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.

Best Answer

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.