-3

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.

Sven
  • 97,248
  • 13
  • 177
  • 225

1 Answers1

1

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.

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255