I recently had the most infuriating issue with a scheduled task on a Win 2008 R2 server. All I wanted it to do was run a .bat file once a day which fired a WGET script. If I logged into the server and clicked the bat file, it fired and triggered the WGET script and everything worked.

But whenever I tried to run it from the Task Scheduler (Either manually pressing run or letting it fire off the schedule), it failed and returned the code 0x1

I checked the history and log and it said it successfully completed with the following:

action "C:\Windows\SYSTEM32\cmd.exe" with return code 1

Great bit of information! Anyway, I spent quite some time changing permissions and users to no avail. I managed to make it work in the end, but its still not completely obvious to me why this makes a difference.

Instead of putting the full file path in the program/script textbox, use the Start in (Optional) field to put the folder that the .bat file is actually in - Like so:

enter image description here

Once you have done this, make sure you tick the 'Run with highest privileges' tick box

enter image description here

And that's it. Its now returning the correct result code 0x0 and my script is running! Finally.