IT Management Suite

  • 1.  Force a Batch Script to fail

    Posted Aug 09, 2011 02:33 PM

    is there a way when I create a task to force a batch to fail according to Altiris?

     

    Example:

    I want to uninstall Flash on a pc but I do not want to run this if Internet Explorer is running at the time.

    So I will run through a routine for 60 min looping and checking.  After this time frame if IE is still open I would like to Fail because I never actually ran the uninstall of Flash.

     

    Any ideas on what I can do in my Batch Script at the end to make it fail according to Altiris?



  • 2.  RE: Force a Batch Script to fail

    Posted Aug 09, 2011 03:22 PM

    You can set the timeout for the task (v7) or program (v6) in Altiris. Once it hits that threshold, it will terminate. However, whenever something terminates\times out it usually give a '0' success code, so it might be hard to track.



  • 3.  RE: Force a Batch Script to fail
    Best Answer

    Posted Aug 09, 2011 03:51 PM

    If you can find the condition within the script where you want it to error out in. Use the batch command:

    EXIT <ERROR CODE>

    0 will be considered a success. This way you can specify the error code and track upon on that.

    I like to use: 999 - Nothing should return that as a success code :)



  • 4.  RE: Force a Batch Script to fail

    Posted Aug 09, 2011 04:01 PM

    This looks like what I want.  So basically I setup a ok IE is open so:

    GOTO :Fail

    :Fail

    EXIT 999

     

    And this will send back 999?  I'm testing and thank you for the info!



  • 5.  RE: Force a Batch Script to fail

    Posted Aug 09, 2011 04:28 PM

    Works Great

    Thank you!