1 2 Previous Next 18 Replies Latest reply: Jun 20, 2012 12:33 PM by EMiranda RSS

    Calling preferred server in a batch file

    Novar Apprentice

      Our software deployment folks like to use batch files to push software/scripts around the organization.  Our network people don't like us pulling packages across the WAN links.  I realize that multicast handles most of these issues but we are beginning to implement preferred servers as well.  Has anyone figured out how to put a variable in a batch file so it will still download from the preferred server vs. the core?

       

      Thanks, Russ

        • 1. Re: Calling preferred server in a batch file
          zman Master

          Sounds like you are using a wrapper (script that calls an exe/msi setup).  I can think of a couple of ways to accomplish this:

          1. If AD shop use DFS.
          2. Use preferred server tools utility http://community.landesk.com/support/people/jan.buelens/blog/2010/01/21/preferred-server-tools
          3. Use additional files in the distribution package - setup the batch file as the main and include all the files called by the wrapper. Make sure you alter the path in your batch file to call the setup from the cache location.
          • 2. Re: Calling preferred server in a batch file
            BlairK Apprentice

            I'm not sure on what your exact software/scripts process is doing without knowing more......but maybe this will help. I don't think LANDesk have built in a variable that can be used on the fly during software distribution tasks/imaging yet to get the preferred server name.

             

            Scenario 1:

            • Distribution package with BAT file as primary file, other files as additional files.
              • Answer: If you use a download from source / run from source delivery method, then preferred servers should be used automatically by SDClient if you've set them up.

             

            Scenario 2:

            • Distribution package with BAT file as primary file. You want to download the CMD file then within it map a drive to a preferred server to copy or run something from it. 
              • Possible Answer: Investigate Jan Buelens 'prefmap' tools which can read a server name from the preferredserver.dat file from c:\program files\LANDesk\ldclient\data and map a drive or set an environment variable to it.
                • I've used this with imaging in WINPE, not with software distributions but it may work.

             

            • 3. Re: Calling preferred server in a batch file
              BlairK Apprentice

              LOL, sorry Zman, I was writing that at the exact same time as you. Glad to see we both had the same things in mind though. Regards, Blair

              • 4. Re: Calling preferred server in a batch file
                spitzej Rookie

                Unfortunately the preferred server tools only work under WinPE.  Anyone else have thoughts on this as  have to do basically the same thing.  Batch file that copies files from the local server and then writes a file up to the preferred server when its done.  I haven't looked yet, but is the perferred server file in LD9 consistent enough to be read?

                • 5. Re: Calling preferred server in a batch file
                  RichardA Apprentice

                  I re-appropriated a bunch of the code from the preferred server tools to enable some level of preferred server awareness in my own AutoIT scripts. It should be LDMS9.0 compatible. I'll see if I can dig something out.

                  • 6. Re: Calling preferred server in a batch file
                    RichardA Apprentice

                    Actually, rather than waiting around for me to dig out old code, have you tried the updated version of the tools from droppeDPackets? I belive that version supports running from within Windows.

                    • 7. Re: Calling preferred server in a batch file
                      Apprentice

                      Could you create a template for the software deployment that maps to your Software store then have a second task to run from that location specified?

                      • 8. Re: Calling preferred server in a batch file
                        spitzej Rookie

                        I did an initial test of the updated prefmap and it actually caused sdclient.exe to consistantly crash.  Plus, the help on it still says it only runs under WinPE.  Anyone use it on other platforms?

                        • 9. Re: Calling preferred server in a batch file
                          RichardA Apprentice

                          Pretty sure I got something working. If you can wait until next week, I'll see what I can find out. What LANDesk service pack level are you at, out of curiosity?

                          • 10. Re: Calling preferred server in a batch file
                            Novar Apprentice

                            Thanks for your efforts.  We are running 9.0 SP3.

                            • 11. Re: Calling preferred server in a batch file
                              BlairK Apprentice

                              I have a version of prefmap which is my edit of the original Jan Buelens code, that from experience works under both WinPE and Windows in 9.0. Happy to provide this to the community as long as someone from LANDesk authorises me to do so. They can contact me if that is that case and I'll post it.

                              • 12. Re: Calling preferred server in a batch file
                                zman Master

                                Blair if you post the autoitscript here I will make sure it gets up to the community and dropped packets.

                                • 13. Re: Calling preferred server in a batch file
                                  BlairK Apprentice

                                  Hey Zman,

                                   

                                  Attached is Prefmapv3. As per the script credit goes to original author, I've merely modded it to add this functionality. I've tested the drive mapping feature successfully in both WinPE and Windows.

                                   

                                  Couple of things to note:

                                   

                                  • Simply run prefmapv3 in a CMD or provisioning template with the existing required parameters. It creates a mapped drive letter which can then be used by rest of script or template.
                                    • It appears that the default behaviour within windows is that the tool leaves visible disconnected network drive mappings in explorer until the system is restarted (disconnected and inaccessible to the logged in user). Perhaps we could work on a second executable to clean these up. Thinking of software distribution scenarios.
                                  • I've not tested the /var switch in Windows yet, and anyway this works in conjunction with a second executable called runenv. I will test this when I have time. In WinPe the /var switch allows for the creation of a system environment variable to use instead of a mapped drive letter.

                                   

                                  Let me know if you find any issues.

                                   

                                  All the best

                                  Blair

                                  • 14. Re: Calling preferred server in a batch file
                                    Ascott860 Specialist

                                    For batch files we use %~dp0 as the clients themselves will go thier local cache, peers, then preferred server before they come back to the core. So %~dp0 will run the code from wherever it lies.

                                     

                                    Instead of \\SERVERNAME\SoftwareVendor\Software\Setup.exe it would be %~dp0SoftwareVendor\Software\Setup.exe.

                                    1 2 Previous Next