9 Replies Latest reply on Jan 30, 2008 5:42 PM by zman

    Notify Core when package exits

    rdm Apprentice

      Is there a way to tell the core server that a package aborted?  For example, the package checks for a regkey, and if it isn't found it exits.  But in the console it looks like the package installed successfully.  I know it's possible to send messages back to the core (e.g. SDCLIENT.exe /msg="FAILED because ...", but the client still reports "done".  What I'm looking for is a way to tell the core "failed".  I think Landesk's Package Builder might do this, but we don't use it.  Thanks.

        • 1. Re: Notify Core when package exits
          zman Master

          You could use a prequisite query or application. If the information u are looking for is in the LANDesk DB this is easy to create a query on the data. If not create a script, batch file, package builder package that looks for the reg key and fails if found.

          • 2. Re: Notify Core when package exits
            rdm Apprentice

            I'm talking about during the SWD task ... while the package is running on the client, I want to be able to report "failed".  So when I look at the task status, I will see "failed".  For example, the package checks for the existence of a regkey.  If it isn't found, it will report "failed" to the console and then exit.

            • 3. Re: Notify Core when package exits
              Jared Barneck SupportEmployee

              Can you be more specific?


              What kind of Distribution Package?  Batch file, Package builder?


              In a batch file you can simply tell it to exit with any exit code you want:


              REM the batch file
              REG QUERY ...
              REM If it returns and error failed (1) then exit.
              IF %ERRORLEVEL% 1 GOTO exit
              :do other stuff
              REM You other stuff here


              1 of 1 people found this helpful
              • 4. Re: Notify Core when package exits
                rdm Apprentice

                We use Wise to build EXEs.  I know that batch files can set errorlevel, but that probably won't work from inside a Wise EXE.

                • 5. Re: Notify Core when package exits
                  zman Master

                  If my memory serves me, if you use a prereq query or app, it will show failed.  Prereqs run before the main app so you will not have to mod your current package (MSI, EXE, etc..) We use them all the time and they work very well.  Just create a quick batch file (reg query .....) or script that checks for the reg key and exits with a failure (<> 0). Just saw rhyous example   

                  • 6. Re: Notify Core when package exits
                    rdm Apprentice

                    I want it to report failed while the client is running the package for many reasons.  Another example is if the inventory is out of date, etc.  The prereq query may allow the PC to run the package, but then it fails because of some check inside the package.

                    • 7. Re: Notify Core when package exits
                      zman Master

                      Understood, just think that all those checks and balances can be placed in the prereq without messing with the main package. If you are good with wise then yes you can put it in the main package, but IMHO it is easier to place those checks in a prereq.  Just my two cents and we do this all the time an it works very well.






                      One thing I though was cool is that when you use a disto package that has a prereq in it in another package as a prereq the prereq works! So it can be stringy but it seems that you can chain them.,,,

                      • 8. Re: Notify Core when package exits
                        rdm Apprentice


                        Gotchca ... but I'm still looking for a way to do this via SWD task, maybe using a SDCLIENT switch, etc.  And here's another reason ... if it isn't in the inventory, I can't use prereq query.  I would first have to update LDAPPL to track it, wait for all clients to scan for it, and then prereq would work.  I've also thought of using a custom vul in Patch Manager, because those conditions are checked when vulscan runs.  The same sort of checks would be very useful in SWD task. 



                        The Detection option looks like what I want, but I think that only applies to dependent packages.  According to Help:  "A match on one or more criteria prevents dependent packages from installing.  This page doesn't affect the primary package."



                        • 9. Re: Notify Core when package exits
                          zman Master


                          That would be one way to do it - ldappl. However, look at the rhyous example. This could be the start of  our prereq distro package. It would:





                          • Look for the reg key you are trying to locate - REG QUERY  ........

                          • Depending on your requirement - you want to find it or you don't want to find - have the batch file return a non-zero return code EXIT /B 100



                          LANDesk will see the non-zero return code, not install the main package and return a failed status.  If you want to evaluate multiple criteria (e.g., Reg key, files, versions, etc..) either use Autoitscript or VBscript. I would recommend Autoit    No need to worry about uptodate inv records, however, I guess it is possible to run a inv scan in a prereq - LOL.