Skip navigation
1 2 Previous Next 1411 Views 18 Replies Latest reply: Jun 20, 2012 12:33 PM by EMiranda RSS
Novar Apprentice 50 posts since
Dec 17, 2007

Has received 1 of 9 achievements.
Currently Being Moderated

May 3, 2012 2:15 PM

Calling preferred server in a batch file

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

  • zman Master 3,277 posts since
    Dec 14, 2007

    Has received 9 of 9 achievements.
    Currently Being Moderated
    1. May 3, 2012 2:38 PM (in response to Novar)
    Re: Calling preferred server in a batch file

    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.
  • BlairK Apprentice 71 posts since
    Feb 27, 2008

    Has received 3 of 9 achievements.
    Currently Being Moderated
    2. May 3, 2012 2:56 PM (in response to Novar)
    Re: Calling preferred server in a batch file

    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.

     

    

  • BlairK Apprentice 71 posts since
    Feb 27, 2008

    Has received 3 of 9 achievements.
    Currently Being Moderated
    3. May 3, 2012 2:57 PM (in response to zman)
    Re: Calling preferred server in a batch file

    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

  • spitzej Rookie 26 posts since
    Aug 16, 2009

    Has received 1 of 9 achievements.
    Currently Being Moderated
    4. May 24, 2012 5:22 AM (in response to Novar)
    Re: Calling preferred server in a batch file

    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?

  • RichardA Apprentice 152 posts since
    Apr 14, 2010

    Has received 4 of 9 achievements.
    Currently Being Moderated
    5. May 24, 2012 9:11 AM (in response to spitzej)
    Re: Calling preferred server in a batch file

    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.

  • RichardA Apprentice 152 posts since
    Apr 14, 2010

    Has received 4 of 9 achievements.
    Currently Being Moderated
    6. May 24, 2012 9:21 AM (in response to spitzej)
    Re: Calling preferred server in a batch file

    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.

  • Apprentice 57 posts since
    Jul 9, 2010

    Has received 3 of 9 achievements.
    Currently Being Moderated
    7. May 24, 2012 11:02 AM (in response to Novar)
    Re: Calling preferred server in a batch file

    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?

  • spitzej Rookie 26 posts since
    Aug 16, 2009

    Has received 1 of 9 achievements.
    Currently Being Moderated
    8. May 24, 2012 3:24 PM (in response to RichardA)
    Re: Calling preferred server in a batch file

    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?

  • RichardA Apprentice 152 posts since
    Apr 14, 2010

    Has received 4 of 9 achievements.
    Currently Being Moderated
    9. May 25, 2012 8:30 AM (in response to spitzej)
    Re: Calling preferred server in a batch file

    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?

  • BlairK Apprentice 71 posts since
    Feb 27, 2008

    Has received 3 of 9 achievements.
    Currently Being Moderated
    11. Jun 19, 2012 5:53 PM (in response to Novar)
    Re: Calling preferred server in a batch file

    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.

  • zman Master 3,277 posts since
    Dec 14, 2007

    Has received 9 of 9 achievements.
    Currently Being Moderated
    12. Jun 19, 2012 6:43 PM (in response to BlairK)
    Re: Calling preferred server in a batch file

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

  • BlairK Apprentice 71 posts since
    Feb 27, 2008

    Has received 3 of 9 achievements.
    Currently Being Moderated
    13. Jun 20, 2012 2:31 AM (in response to zman)
    Re: Calling preferred server in a batch file

    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

    Attachments:
  • Ascott860 Specialist 183 posts since
    Aug 18, 2009

    Has received 5 of 9 achievements.
    Currently Being Moderated
    14. Jun 20, 2012 4:19 AM (in response to BlairK)
    Re: Calling preferred server in a batch file

    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

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • Correct Answers - 20 points
  • Helpful Answers - 10 points
LANDESK Community powered by Jive SBS® 4.5.7.1  |  Legal Notices  |  Privacy Policy  |  Icon 

TweeterOn Twitter  |  Icon FacebookOn Facebook © 2007 LANDESK Software