VB.NET - fail to Task or JobQuestionAsk A New QuestionVB.NET exe return success or fail to Task or

Asked By M McGurk on 07-Jan-13 10:43 AM
I need to run an VB.NET exe using either Windows Task Scheduler or Sql Server Agent Job.  What do I need to code in the exe so it will report to the task or job if it completed successfully or failed?  

Also, what do I need to add to the task or job so it will wait for the program to complete?


Have never done this before so don't know where to start.  Have been searching the web for 2 days but don't really find what I need.

Thanks for any help in advance.
Robbe Morris replied to M McGurk on 07-Jan-13 11:12 AM
They are both going to report success if the process didn't lock up and crash or the scheduler didn't have to kill the process based on running time constraints.   You'll want to wire up your exe to send you an email or write to a log file if things went wrong.
M McGurk replied to Robbe Morris on 07-Jan-13 12:32 PM
I'm surprised there is no way for either to monitor the exe.  Thanks for your help.  Will follow your advice.
Robbe Morris replied to M McGurk on 07-Jan-13 12:38 PM
There are all sorts of things that could cause your application to fail to do what you expected it to do.  There is no way the operating system could know what those things are.  Perhaps the database the app connects to is down?  Perhaps the network is down?  Maybe some other set of expected business rules were not met?  Perhaps an NTFS drive permission was changed that should not have?  All sort of stuff can happen as the months go by.

You'd want to know specifically what happened in these scenarios and the Windows Task Scheduler just isn't going to give you that.