I'm facing strange issue in Windows Server 2008 R2 Task Scheduler. I have create one task with .bat file. Its working when I run it manually, but when I schedule this through Task Scheduler. Did not getting any output.

I have enabled the task history and the history log show that this file Executing successfully.

Task Scheduler successfully completed task "\RenewalSMS" , instance "{cf6ebd95-027c-4d0b-b893-a67d01323c49}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 1.

Task Scheduler successfully finished "{cf6ebd95-027c-4d0b-b893-a67d01323c49}" instance of the "\RenewalSMS" task for user "WIN-REAL\Administrator".

I appreciate any ideas anyone may have.

closed as off-topic by kasperd, Ward, Jenny D, Reaces, mdpc Jun 7 '17 at 20:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What kind of output are you expecting? Scheduled tasks run in the background... – Sven May 16 '17 at 10:17
  • The .bat file is not giving any output. – Knight Rider May 16 '17 at 10:58
  • 2
    Again: Scheduled tasks run in the background. What kind of output are you expecting? What happens instead? – Sven May 16 '17 at 11:07

Your task is executing. It is not exiting correctly. See that return code 1 at the end of the message? That's indicating that your program is not exiting in an expected manner.

This means that something went wrong during the execution of the application. This is very common - some applications expect a certain environment that isn't present during task execution. Maybe it expects UAC elevation but your task isn't set to be elevated. Maybe it expects a mapped drive, which you won't have in a scheduled task.

There are a dozen things that could be wrong with your task, and nobody can know except for you. It's time to add debugging into your task and go from there.

Not the answer you're looking for? Browse other questions tagged or ask your own question.