We help top organizations stay competitive, by implementing the latest disruptive technologies.

Latest Posts
 

SSH LANDESK Agent Installer Script

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 Comments
  • Sameer Ahmad Halawani
    Posted at 07:24h, 19 November Reply

    We have tried to remotely deploy the agent on devices with no luck, then we have installed it manually but we should be able to remotely deploy it using the LANDESK Console

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

      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.

Post A Comment