Nine41 Consulting | Deploying AppleScripts with LANDESK Management Suite
apple, device management, dep, vpp, systems management, landesk, ivanti, lanrev, absolute, heat, mdm,
16485
post-template-default,single,single-post,postid-16485,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
 

Deploying AppleScripts with LANDESK Management Suite

Deploying AppleScripts with LANDESK Management Suite

Recently I was on a call with a current LANDESK Management Suite customer and he was expressing his disappointment to me regarding LANDESK’s inability to support AppleScripts.

Imagine his surprise when I told him he could.

Now, the information the support team provided to this customer is “technically” correct, LANDESK Management Suite does not natively support direct AppleScript deployments.

However, with a very simple workaround you can take advantage of the power of all of your AppleScripts and use LANDESK to deploy them. And, the best part about the workaround, you don’t have to change the AppleScript at all. You simply need to put a shell script wrapper around it.

A couple of weeks back, I blogged about how you can update your the Exchange server in a client devices Outlook settings and in that blog, I used this very trick to wrap my AppleScript in a shell script to deploy it out with LANDESK.

Let’s walk through an example of how to create that wrapper.  Grab your AppleScript or use my simple example below that will set a desktop background.

tell application "System Events"
 tell every desktop
 set picture to "~/Pictures/IvantiScreen1.jpg"
 end tell
end tell

If you were to copy the text above into Apple’s ScriptEditor application and hit play, after having tweaked the “set picture path” to match a valid path on your machine, your desktop backgrounds will all update.

However, if you were to save the file and deploy it with LANDESK, it would fail.  This is where the workaround comes in.

Opening up a text editor, such as TextWrangler or Xcode, and create a new Shell script. For our workaround, we need to change the interpreter in the shebang line.  Typically, your shell script will have something similar to ‘#! /usr/bin/sh’.  Change it to:

#!/usr/bin/env osascript

That is all you have to do.  Now you can copy in your AppleScript, save the file as a .sh file, set the execute permissions on the file and deploy it as a standard package.

In my example script, I added an additional line to download the desired background image.  My entire script to set the desktop background is available below or can be downloaded from GitHub:

#!/usr/bin/env osascript

# setDesktopBackground
# Created by Bennett Norton on 1/25/17.

# you first need to download your background image you'll use
# call the directory you want to save the background image to
# set the download path to your image
do shell script "cd ~/Pictures && { curl -O http://bn-sgu-ldserver.ldlab.org/SoftwareDist/IvantiScreen1.jpg; cd -; }"

# run the applescript to set the desktop background
# make sure the paths match
# if you set the path to ~/Pictures above, then it should be ~/Pictures below
tell application "System Events"
 tell every desktop
 set picture to "~/Pictures/IvantiScreen1.jpg"
 end tell
end tell

If you’re new to LANDESK or scripting, the information below will assist you in setting the file permissions and creating the package.

To set the permissions, you need to open Terminal and run:

chmod +x /path/to/your/script.sh

With the script now ready for execution, zip it and copy it to your package share.  Once you’ve done that, build the LANDESK software package.

  • From the LANDESK Console, open Tools > Distribution > Distribution Packages
  • Inside the menu tree, highlight My Packages or Public Packages and then select the New Package button on the menubar and select New > Macintosh > Macintosh Agent
  • Give the package a name, description and point the primary file to the .sh file created previously
  • Fill out the Metadata details if desired
  • Save the package
No Comments

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