One of the issues you can run across with systems management tools is doing an automated uninstall and reinstall of the agent software. The dilemma is that you can tell the agent to uninstall itself, but after that there’s no agent software on the machine to run the reinstall command. Most management tools include the ability to scan your network and install agents on machines automatically, but that may not be appropriate for all environments as you may have some machines where you don’t want to install the systems management agent.
I ran across a situation like that recently in my own environment. For details, see below the jump.
My workplace runs both JAMF Software’s Casper and Dell Kace’s KBox 1000 agents on our Macs. We recently updated our KBox to version 5.4, but Kace has the following known issue listed in the 5.4 release notes:
11002: Client machines running Mac OS 10.8 and K1000 Agent version 5.3 cannot upgrade to Agent version 5.4. Dell KACE recommends that you either upgrade to Agent version 5.4 before installing Mac OS 10.8, or uninstall and reinstall the Agent software manually.
Since I already had a number of 10.8 Macs in my environment with the 5.3 agent installed, I wanted to have Casper handle the uninstall and reinstall of the KBox agent for me, rather than doing it manually on the affected machines. I also wanted to target just the 10.8 Macs with the 5.3 agents. After doing some poking around, I saw that the KBox agent had the version number stored in the /Library/Application Support/Dell/KACE/data/version text file.
Once I had that information, I wrote the following Casper extension attribute to check for that file and pull the agent version information from it:
#!/bin/sh # Check to see if the KBox agent is installed. # If the agent is installed, report the agent # version. if [ -f "/Library/Application Support/Dell/KACE/data/version" ]; then result=`cat "/Library/Application Support/Dell/KACE/data/version" | grep 5` echo "<result>$result</result>" else echo "<result>Not installed</result>" fi
For those interested, the extension attribute is available here on my GitHub repo:
Once I had the version information available, I then set up a smart group that only included 10.8 Macs with the 5.3 version of the KBox agent. From there, I built a new Casper policy that uninstalls the older KBox agent, then installs the new 5.4 agent and set the policy scope to target the machines in the previously-mentioned smart group. After that, Casper took care of the automated uninstall and reinstall of the KBox agents during the affected machines’ next check-in with the Casper server.