Nine41 Consulting | Efficiently Transfer Files to an OS X Device with SDClient
apple, device management, dep, vpp, systems management, landesk, ivanti, lanrev, absolute, heat, mdm,
688
post-template-default,single,single-post,postid-688,single-format-standard,qode-quick-links-1.0,ajax_fade,page_not_loaded,,columns-3,qode-child-theme-ver-1.0.0,qode-theme-ver-11.0,qode-theme-bridge,wpb-js-composer js-comp-ver-5.1.1,vc_responsive
 

Efficiently Transfer Files to an OS X Device with SDClient

Efficiently Transfer Files to an OS X Device with SDClient

Have you ever needed to copy a file from a share to a more than one Mac in your environment?  My guess is the answer to that is yes, I know it was for the potential customer I spoke with on the phone today.  Whether you’re trying to apply a configuration file for a package, settings for a proxy server, VPN configuration files or any of the myriad of other reasons, what you’re transferring isn’t the important question, it’s how do you do it.

Luckily sdclient, the tool that is the brains behind all things software distribution for the Mac, has a bunch of goodness via command line switches that can be used to download files and place them into specific locations; all the while still taking advantage of the download technologies built into the agent.

To leverage sdclient, we’ll write a shell script that will tell sdclient what file to download and where to place it.  The entire script is very short.  There will be two variables, one for the source file location and the second for the destination location.

The only thing you need to really pay attention to in regards to the source location is to ensure the file is accessible via http.  You can setup a variable or just supply the location.  I like to create a variable so that the code can be better documented and easier to read for others.  Here is my source variable.

We’ll repeat the process for the destination location.

In addition to the destination variable, the script will include a quick check to ensure the destination folder exists on the end node and if not, create it.

The actual download and placement of the file will be done by sdclient with three switches: -noinstall, -package and –destdir.  The switch names are pretty self-explanatory, the –noinstall tells sdclient to not execute the file that will be downloaded.  The –package switch is where you insert the path to the source file available, again available on the http share.  Lastly, the –destdir switch tells sdclient where to place the file on the Mac client.

All done, your command sdclient command should look something like:

Here is the entire example script.

As discussed in previous posts, save this file as a .sh file and set the execute permission on it by running the command below.

Once you’ve set the execute permissions, copy the script to your package repository and create a LANDESK Software Distribution package to deploy.

Creating LANDESK Management Suite Mac Packages

  1. Open the LANDESK Console
  2. Navigate to the top menu bar, select Tools > Distribution > Distribution Packages.
  3. In the lower left menu tree, highlight My Packages or Public Packages from within the Distribution Packages window
  4. On the Distribution menu bar, press the New Package button and select New Macintosh Package.
  5. Give the package a name
  6. Provide a description as well as any metadata information desired
  7. Set the primary file to the script file you previously transferred to your package share
  8. Fill out the Metadata details if desired, specifically supplying a logo so it shows up properly in the portal
  9. Save the package

Creating a Scheduled Mac Software Distribution Task

  1. Right click on the Mac software distribution package created and select Create Scheduled Task
  2. From the network view, select and drag the desired machine(s), user(s) or query(ies) and drop them onto the task
  3. Now, right click on the task and select properties
  4. Set the desired Task type under Task Settings as to whether you want a push, a policy or a hybrid of the two types in a policy-supported push
  5. Set the radio button in the Portal Settings to either Recommended or Optional if you desire to put the package into Workspaces.  If you’d like to automatically deploy the app, select Run automatically
  6. Change the Reboot Settings or Distribution and Patch settings if desired
  7. Set the schedule task settings with the appropriate start time

 

3 Comments
  • Jerry Horn
    Posted at 09:22h, 02 December Reply

    How would you copy a shell script file down and run it?

    Here is my LD script I created in Managed Scripts.

    REMEXEC01=sdclient –noinstall –package http://%CUSTJOBHOSTIP%/software/MAC/Kaspersky/kesmac10_0_0_327m/51772D39.key -destdir /Library/Application Support/LANDesk/sdcache
    REMEXEC02=sdclient –noinstall –package http://%CUSTJOBHOSTIP%/software/MAC/Kaspersky/kesmac10_0_0_327m/install.sh -destdir /Library/Application Support/LANDesk/sdcache
    REMEXEC03=sdclient –noinstall –package http://%CUSTJOBHOSTIP%/software/MAC/Kaspersky/kesmac10_0_0_327m/kesmac.dmg -destdir /Library/Application Support/LANDesk/sdcache
    REMEXEC04=sdclient –noinstall –package http://%CUSTJOBHOSTIP%/software/MAC/Kaspersky/kesmac10_0_0_327m/kesmac.kud -destdir /Library/Application Support/LANDesk/sdcache
    REMEXEC05=sdclient –noinstall –package http://%CUSTJOBHOSTIP%/software/MAC/Kaspersky/kesmac10_0_0_327m/license_en.txt -destdir /Library/Application Support/LANDesk/sdcache
    REMEXEC06=sudo /Library/Application Support/LANDesk/sdcache/install.sh

    • Bennett
      Posted at 23:05h, 03 December Reply

      You don’t need to add sudo to your script as it is already running as root – that may be the cause itself of the failure. Also, I don’t use Managed Scripts. Just write your .sh file, set the execute permissions and then create a standard Mac Package and deploy it out just as you would an application.

      Example script below:

      #!/bin/sh

      # Created by Bennett Norton on 12/3/16.
      # This script will download a set of files and execute the script

      #Script Variables
      #change the IP address to match your core server IP address
      filePath=”http://coreserverIP/software/MAC/Kaspersky/kesmac10_0_0_327m”
      destinationDirectory=”/Library/Application Support/LANDesk/sdcache”

      #sdclient downloads the files
      /Library/Application Support/LANDesk/bin/sdclient -noinstall -package “$filePath””/51772D39.key” -destdir “$destinationDirectory”
      /Library/Application Support/LANDesk/bin/sdclient -noinstall -package “$filePath””/install.sh” -destdir “$destinationDirectory”
      /Library/Application Support/LANDesk/bin/sdclient -noinstall -package “$filePath””/kesmac.dmg” -destdir “$destinationDirectory”
      /Library/Application Support/LANDesk/bin/sdclient -noinstall -package “$filePath””/kesmac.kud” -destdir “$destinationDirectory”
      /Library/Application Support/LANDesk/bin/sdclient -noinstall -package “$filePath””/license_en.txt” -destdir “$destinationDirectory”

      # run the installer script
      /Library/Application Support/LANDesk/sdcache/install.sh

  • Nine41 Consulting | Have You Ever Needed to Send a Notification or an Alert to Your Entire Organization?
    Posted at 10:07h, 21 February Reply

    […] Therefore, all you need to do at this point is write a script that will download your Script Editor application and run it. We will still use SDClient in our script, giving us bandwidth controls and peer sharing. For more information on creating such scripts, see my blog post on efficiently transferring files with sdclient. […]

Post A Comment

ARE YOU READY TO GET STARTED?
Please fill out your information, and a specialist will reach out to discuss our services in more details.
Your Information will never be shared with any third party.
        
Free Training Videos
Register to gain access to all of our free content.
YOUR PHONE
YOUR NAME
YOUR EMAIL
        
Get Started
Provide us your contact information and we will reach out as quickly as possible.
YOUR PHONE
YOUR NAME
YOUR EMAIL
        
Additional Questions?
Provide us your contact information and we will reach out as quickly as possible.
YOUR PHONE
YOUR NAME
YOUR EMAIL
        
Pay by PO?
Provide us your contact information and we will reach out to help you sign up by PO.
YOUR PHONE
YOUR NAME
YOUR EMAIL
Subscribe Now
Subscribing to our site gives you access to our Apple Admin 101 training videos as well as allowing us to notify you of each new blog post we release.
YOUR PHONE
YOUR NAME
YOUR EMAIL
Pay by PO
Send us your contact information and we will reach out to help you sign up by PO.
YOUR PHONE
YOUR NAME
YOUR EMAIL
Additional Questions?
Send us your contact information and your questions and we will reach out as quickly as possible.
YOUR PHONE
YOUR NAME
YOUR EMAIL
YOUR QUESTIONS
Get Started
Provide us your contact information and we will reach out as quickly as possible.
YOUR PHONE
YOUR NAME
YOUR EMAIL
Free Training Videos
Subscribing to our site gives you access to our Apple Admin 101 training videos as well as allowing us to notify you of each new blog post we release.
FIRST NAME
LAST NAME
PHONE
EMAIL
Subscribe Now
Subscribing to our site gives you access to our Apple Admin 101 training videos as well as allowing us to notify you of each new blog post we release.
FIRST NAME
LAST NAME
PHONE
EMAIL