SSH LANDESK Agent Installer Script

The other day I was working with a customer in which the LANDESK Console was unable to successfully push an agent to a Mac device; despite having SSH access when using Terminal.

As a result, I wrote a script that was used to deploy the agent without leveraging the LANDESK console.  I figured the script could be useful for other new customers that may already have Apple Remote Desktop or some other software distribution tool in place and could use this script to deploy the LANDESK agent in their environment.

The entire script can be downloaded from on GitHub inside the Custom SSH Agent Install folder.

The script is quite simple.  The first section establishes the variables.  Replace the path for your core with the appropriate IP address and change the name of the agent to match your unique name.  Remember to properly handles spaces if need be.  And that should it be all you need to change in this script.  Everything else should work in your environment as written.

#!/bin/bash 
## replace "http://192.168.29.13/ldlogon/mac/" with your core server FQDN or IP
## replace "BaseMacAgentnoav.dmg" with your agent name, remembering to appropriately handle spaces in the name if applicable.
CORE=http://192.168.29.13/ldlogon/mac/
AGENTNAME=BaseMacAgentnoav.dmg

The subsequent section checks to see if the LANDESK folder already exists on the Mac.  If it does, the script will exit out.  This will ensure you’re not re-installing an agent on a machine that is under management.

detect if the agent is already installed
if [ -d "/Library/Application Support/LANDESK" ]; then
 echo 'The LANDESK Agent is Installed'
 exit 1
 
 else echo 'The LANDESK Agent Needs to be Installed'

If the LANDESK folder path does not exist, we will use curl to download the agent from the defined variables above.

 ## download the agent
 curl -o $AGENTNAME $CORE/$AGENTNAME

Once the agent DMG is downloaded, we need to mount it and kick off the installer.

## mount the dmg
 hdiutil attach $AGENTNAME

## install the agent
 sudo -S installer -pkg /Volumes/LDMSClient/ldmsagent.pkg -target /

With the agent installed, we’ll detach the volulme, remove the agent, and close out our if statement that determined if the folder path existed or not.

 ## delete the files downloaded
 hdiutil detach /volumes/LDMSClient
 rm $AGENTNAME
 exit 0
fi

There you have it, hopefully that will assist you in getting the LANDESK agent installed remotely, without having to use the LANDESK console.

 

2 thoughts on “SSH LANDESK Agent Installer Script

    1. Sameer, in order to push an agent you have to have ssh access to it. Have you validated that you can connect via SSH manually? Your Macs need to have the Remote Login service in System Preferences > Sharing enabled in order to push – whether you use the LANDESK console or the script in this blog.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s