Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a backup task that fails with a non zero result, yet Task Scheduler says that it executed the task correctly.

Is there any way to tell Task Scheduler that the task failed?

share|improve this question
    
Hi Pablo, We'll need more info. Like how/what is the task scheduler launching? A batch file, an EXE, something else? Is this Windows Backup that you're dealing with? What have you tried? –  Ƭᴇcʜιᴇ007 Sep 1 '11 at 15:00
    
I'm using the wbadmin program to start the backup, but I have the same problem with a batch file with a single 'exit 1' statement. The TaskScheduler includes the error code, but reports the Task as successfully ran. –  Pablo Montilla Sep 1 '11 at 17:14
    
So the Task Scheduler itself shows the non-zero exit code? –  Ƭᴇcʜιᴇ007 Sep 1 '11 at 17:19
1  
Yes, but reports the task as executed successfuly. I gather that maybe it's reporting that it could execute the task, not that the task itself failed, but doesn't seem very useful. –  Pablo Montilla Sep 2 '11 at 12:22
add comment

1 Answer 1

up vote 0 down vote accepted

If Task Scheduler successfully launches the task and the launched program exits, then from the point of view of the Task Scheduler it was a success (i.e., nothing bad happened like a failed user credential starting the program).

Normally if you want to monitor for something bad that happened during a program run you would either have the program send an alert of some sort (e.g., via email or by logging to a file that you later review), or else setup another program to monitor something about the program run that could indicate whether an error occurred.

What sort of notification of an error are you trying to get? Are you doing a manual review but just trying to have the error be more noticeable? Or do you have another program monitoring for errors?

share|improve this answer
    
Still I think it's wrong to fail and not report (or at least give an option to report) failure of the executed task. Thanks! –  Pablo Montilla Feb 13 '12 at 11:35
    
I agree it would be useful if the Task Scheduler could detect the exit code and send an email based on the result. But I don't believe it has that feature. Are you trying to get an email alert? Maybe wrapping the launch of wbadmin in a VBScript or PowerShell script that would detect the exit code and do something with it would be a possibility for you? –  Shannon Wagner Feb 16 '12 at 19:23
    
Yup, that is a possibility. It's also work...;) Hopefully MS will think this is something useful to add to Windows 8. –  Pablo Montilla Feb 17 '12 at 12:25
    
This is mind-blowing to me - Task scheduler has all those options for configuring restart of an action in the event that it 'fails', but doesn't even check if an action returns an error code. Makes me wonder what on earth actually constitutes a 'failure' for the Task Scheduler. –  mackenir Aug 22 '13 at 11:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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