4 Replies Latest reply on Apr 15, 2008 7:04 AM by ahe

    SWD package returning error

    ahe Expert


      Influenced by this discussion Batch File Distribution Returning Error I want to test it with ESWD packages.



      I create a package for a batch file. This batch works if I used it in "Batch File Distribution". I get a message and a error code in Scheduled Task. If the batch failed the task failed (EXIT /B %errorlevel%). ok 



      But if I create a SWD Distribution package of this batch and start it with Scheduled Task, I got the message only. Every time I start it the task is successful. The task never fails if the batch fails... :|



      Is there a possibility to send a error code from a SWD package which started a batch or is there another trick to send a error code to Scheduled Task. I found no information in the docs about package builder...













        • 1. Re: SWD package returning error
          phoffmann SupportEmployee

          Not that I know of - ESWD Package Builder is meant as a basic packaging tool - there's some things with the batch files we can do that ESWD can not - the white paper on batch files sorts that out.


          I've not been able to return an error from something that package builder launched back to SDCLIENT (as a side-note, the whole thing is harder anyway, because SDCLIENT isn't really directly involved with launching ESWD packages - it's all a bit complicated) :).


          In short - if you want fancy stuff like that, batch files are far more useful - as you report back direct to SDCLIENT. ESWD packages have several layers of wrapping (mainly born of historic reasons, as such things are prone to) - so trying to get something back to SDCLIENT is very difficult.


          Hope this helps.


          Paul Hoffmann

          LANDesk EMEA Technical Lead.

          1 of 1 people found this helpful
          • 2. Re: SWD package returning error
            ahe Expert


            Thank you Paul for your answer.



            I feared that there is no solution for it.   :_|



            What about error messages/codes if I use executable packages instead of batch or SWD? Could it work? (I think about using AutoIT executables...)

            If this works, what is the advantage, the benefit of using SWD insteas of EXE Distribution Package?










            • 3. Re: SWD package returning error
              phoffmann SupportEmployee

              I'm having to theorize here, but I would say that - yes - in THEORY it should work. Though I admit I've not tested it, but I would expect it to work - since SDCLIENT runs EXE's directly (unlike SWD packages as written before).


              AutoIT EXE's are (in essence) batch-files after all, so the same calls back to SDCLIENT for status that work for batch files OUGHT to work for EXE's specifically designed to use them.


              Maybe as a positioning for SWD - we provide the package builder as a "no cost", simple packaging solution for primarily simpler needs. It has its limitations, and it was decided not to try and compete with MSI's since that would be re-inventing the wheel (remember, the package builder came out 10+ years ago before there were MSI's).


              We still provide for it, since it's popular with some customers for specific things, but it should not be mistaken for a replacement for MSI's and such.


              Primarily the "benefit" of ESWD is that you can use it nicely to wrap packages into a single file and similar such things which are not easily done with other paths. It's like most things in LANDesk - one of several (usually 3+) ways of doing the same thing, but down to your personal preference.


              Hope this helps.


              Paul Hoffmann

              LANDesk EMEA Technical Lead.

              • 4. Re: SWD package returning error
                ahe Expert

                Hello Paul,


                I found a bit time     to test the installation with AutoIT EXE's as a wrapper.

                To cut a long story short, it works. (I think it would do the same as a fully programmed AutoIT script, not only as a wrapper for batches )


                Here are my  "creating" steps:


                1. Create an installation batch (or VBScript) with a exit code
                                            (for example a errorlevel)

                2. Pack the batch and the installation files in a zip file

                3. Create a exe file with this method: (7zcon.sfx is free console library in the 7zip package)           

                  copy /b 7zcon.sfx + config.txt + mypackage.7z mypackage.exe


                4. Create a AutoIt script which loads the exe file

                5. Build a AutoIT EXE (for example in the editor Scite).


                If the AutoIT package runs it will be unpacked. The AutoIT script unpack the manually created EXE file (with the copy command, s. above), then AutoIT start

                the installation batch and work with the exit code of the batch.


                Extract from Batch: (mybatch.cmd)

                . . .
                EXIT %Errorlevel% 



                AutoIT Script:

                FileInstall("c:\temp\packages\mypackage.exe", "")
                $test = RunWait(@ScriptDir & "\mypackage.exe -y", @ScriptDir, @SW_HIDE)
                $code = RunWait(@ScriptDir & "\mypackage\mybatch.cmd", "", @SW_HIDE)
                FileDelete(@ScriptDir & "\mypackage*")
                Exit $code






                Message was edited by: ahe (code formatting) (s. Plain Text, right top of edit window "Plain Text Markup Help", thanks zman )