4 Replies Latest reply on May 4, 2012 11:24 AM by zman

    Question about deploying a batch file

    Rookie

      Right now we're using SCCM2007 and I'm evaluating LANDesk to see if it's a viable replacement.  We're looking for something that can work with both Macintosh and Windows clients - which SCCM obviously cannot do.

       

      Anyway...  Right now, under SCCM, one of the packages I'm deploying consists of a batch file that installs a pile of .MSI's with patches.

       

      It looks something like this:

       

      MSIEXEC.EXE /i %~dp0something.msi /norestart /update %~dp0someupdate.msp; %~dp0someotherupdate.msp /qn

      MSIEXEC.EXE /i %~dp0somethingelse.msi /norestart /update %~dp0someupdate.msp; %~dp0someotherupdate.msp /qn

      MSIEXEC.EXE /i %~dp0yetanother.msi /norestart /update %~dp0someupdate.msp; %~dp0someotherupdate.msp /qn

      XCOPY.EXE %~dp0JustForTheFunOfIt\stuff.inf C:\ToMakeThingsDifficult\stuff.inf /y

       

      So, obviously, I can create a Batch File distribution package.  I can point it at that batch file, and I can add a bunch of additional files.


      But how does it all work?  SCCM will download all those files into a single location, and I can use %~dp0 to call files from that location.  Does LANDesk do something similar?

       

      If not - is there a way to make this process work nicely with LANDesk?  Or will I need to completely re-invent/re-script/re-package this particular bit of software?

        • 1. Re: Question about deploying a batch file
          MarXtar ITSMMVPGroup

          Hi,

           

          With a Batch distribution, you can set up all of the files that you need as additional files. LANDesk will then copy then to the machine in the Prog Files\LANDesk\LDClient\SDMCache directory. They will all go into the directory structure as that on your source server. So if somthing.msi is in software\MS\MSI\something.msi, then under SDMCache you will see the software\MS\MSI directory structure get created.

           

          If your Batch file is in the same source directoy as the MSI files, then it will also get copied down and be in the same location so it can call them easily. If you store it somewhere else or they are all in different locations, then you need to consider the different locations they will be in.

           

          Hope this helps.

           

          Also be aware that you can sequence these using dependent packages. This allows you to schedule just one of the packages but make it dependent upon another one. If the other package is not present, then it will install it before installing the one you scheduled. This way you could link them all together and not need a batch file except for that last XCOPY part.

           

          I know this may not be 100% clear, so I'd be happy to give some assistance. Just drop me an email to Mark.McGinn AT marxtar.com and we can go a bit more in-depth.

           

          Mark McGinn

          MarXtar Ltd

          http://landesk.marxtar.co.uk

          LANDesk Silver ESP

           

          The One-Stop Shop for LANDesk Enhancements

          - Wake-On-WAN - Distributed Wake-On-LAN, Scheduled Power Down, and SWDist Sequencing

          - State Notifier - Real-Time Device & User State Inventory Updating & Alerting

          • 2. Re: Question about deploying a batch file
            Employee

            If I remember my batch file stuff correctly ~dp0 means current location.  If that's the case this should work without needing to be modified.

             

            LANDesk has two main options for 'where' to run the package.  One is to copy the batch file and all additional files locally and run it from there.  This is the download from source option.  In that scenario you really don't even need to have the %~dp0 because the current directory will already be the current working directory, which will generally be found under the program files [(x86)]\ldclient\sdmcache\<shareName>\ directory where shareName is whatever you named your share on your file hosting server.  Because the files are all individually downloaded you can specify either an HTTP or UNC share and it will work fine.

             

            The other option is Run from Source.  In this scenario the batch file is attempted to be run from whatever network location you specified.  In the case of a batch file this won't work over HTTP, so it would need to be a UNC share.  %~dp0 should also work just fine in that scenario.  Also, things like network stability and permissions on all the files becomes more of an issue.

             

            In either scenario that batch file should run as expected, with %~dp0 being extraneous but not causing any problems either.

             

            EDIT:

             

            Of course MarXtar has to beat me to the punch.  He's like that. . .

            1 of 1 people found this helpful
            • 3. Re: Question about deploying a batch file
              Rookie

              Awesome.  Thanks for the help guys - that's exactly the answer I was hoping for.

              • 4. Re: Question about deploying a batch file
                zman Master

                Good stuff from the M team. One thing with scripts (regardless of language, batch, autoitscript, VB, Powershell, etc..) that sequence multiple installs, is the return codes. Basically was the job successful.  There are some scripting tricks, trapping return codes to variables, but LANDesk will only look at one return code per distribution package. As others have stated your scripts should work well in LANDesk, and as Mark indicated there are numerous ways to handle this task. One problem many new LANDesk customers have is that there are numerous ways to accomplish a task, I call this flexibility some call it confusing.

                 

                In addition to dependant packages you can sequence up to three distribution packages within the scheduled task Preliminary, Main and Final.  Yes I'm old and I realize that there are 4 actions in the script