Symantec Management Platform (Notification Server)

 View Only
  • 1.  Exit code when running .bat file

    Posted Oct 08, 2010 06:47 AM

    Hello.

    I've created simple .bat file, which renames one file. I've created Software Delivery Task for this.

    No matter if this file exits or not, status code for software delivery is always 0 -> Success.

    If I run this .bat locally on the test computer and intentionally remove the file which should be renamed by .bat, run the .bat and get error message "file not found etc." and enter command ECHO %ERRORLEVEL% it returns 1.

    Why this %errorlevel% value is not passed to Altiris Agent??



  • 2.  RE: Exit code when running .bat file

    Posted Oct 08, 2010 10:00 AM

    Thus, the actual BAT file returns a success code.  :D

    You have to RETURN an error code FROM the bat file, not simply echo it to the screen for us to pick it up.  If you echo something, great - it worked, and the bat returns a 0 - which is what we pick up.

    Same thing applies to VBS.  If you echo it - it goes to the screen/console (we use CScript), and thus isn't captured.

    In VBScript, you have to do:

          wScript.quit(errornum)

    In DOS, you use:

         Exit errornum.

     

    GL making this work!



  • 3.  RE: Exit code when running .bat file

    Posted Oct 08, 2010 10:13 AM

    Hi Thomas,

    Thanks for reply.

    I'll try your suggestion on monday.