0

I have a simple batch file that moves files from one folder to another - the source folder is a network path in the form \SERVERNAME\g$\Extract. The full command is:

move \\SERVERNAME\g$\Extract\updates*.txt D:\Import\NewFiles

I can run this batch file manually and it works fine. However, I've set it up as a scheduled job (on the destination server) and every time it runs, it shows:

Task Scheduler successfully completed task "\Transfer files" , instance "{3885bcd7-7b78-4de6-a95d-c6ab7b4d480b}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 2147942401.

The job runs as a user who has full access to both the source and destination folders and has rights to "Log on as a batch job" as well. Both servers are Windows Server 2012.

The job has the following specified:

  • Run whether user is logged on or not
  • Do not store password
  • Run with highest privileges
  • Configure for: Windows Server 2012 R2

In the Action panel, I've put the batch file name in the Program/script box both with and without it's full path. I've also tried including and excluding the path in the "Start in" box.

I've tried sharing the source folder, giving full control to the user the batch job is running as, and then using both the share name and the full network path but that also hasn't resolved the problem.

Whatever I try, the task still completes with the same exit code and the batch file doesn't run.

I've spent ages searching around for this and though there appear to be plenty of other people who've experienced this same exit code, none of the things suggested have worked.

Can anyone suggest why this might be happening or what I can try to get round it? Is it something to do with the source folder being a network path?

I'm under a bit of pressure to resolve this so any suggestions would be much appreciated.

Thanks

user2724502
  • 181
  • 2
  • 3
  • 13

2 Answers2

0

So I finally found out what the issue was. I needed to untick the "Do not store password" option in the task settings, but once I'd done that, there's a local security policy on the server the task was set up on that prevented it from running: "Network access: Do not allow storage of passwords and credentials for network authentication"

When I moved the task to run on a different server that did not have this policy enabled, it ran without issue.

Maybe that will help someone else facing this problem :-)

user2724502
  • 181
  • 2
  • 3
  • 13
0

I was able to resolve this issue differently by doing below-

  1. Set expiration date for the task (a year in future)
  2. Enable / Disable task (Reset to Enable)
  3. Click Hidden checkmark and then uncheck again

by doing above 3 things, my scheduled taks started running as expected