Home > Mac administration, Packaging, Scripting > KBox agent removal script

KBox agent removal script

At my job, we’re using Kace’s KBox to handle our inventory and patch management (we’d like it to do more, but that’s mostly what it’s doing at this point.) One thing that I’ve noticed is that the KBox agent tracks logins and logouts. Sometimes, this process goes awry and your login will hang for two minutes until the loginwindow process hits a timeout limit, forcibly kills that process, and allows the rest of the login to proceed.

The fix in this case is to uninstall and reinstall the agent. Kace provides directions on how to uninstall the Mac agent, but it looks like the directions weren’t updated for 10.6.x, so I knocked together this script to uninstall the agent on 10.4.x – 10.7.x:


# Removes the 5.3 KBox agent

sudo /Library/StartupItems/AMPAgentBootup/AMPAgentBootup stop
sudo /Library/Application\ Support/Dell/KACE/bin/AMPctl stop 2>&1
sudo /Library/Application\ Support/Dell/KACE/bin/kagentctl stop 2>&1
sudo rm -rf /Library/Application\ Support/Dell
sudo rm -rf /Library/StartupItems/AMPAgentBootup
sudo rm -rf /Library/Receipts/AMPAgent.pkg
sudo rm -rf /var/db/receipts/com.kace.ampagent.bom
sudo rm -rf /var/db/receipts/com.kace.ampagent.plist
sudo rm -rf /Library/LaunchAgents/com.kace.AdminAlert.plist
sudo rm -rf /Library/LaunchDaemons/com.kace.ampagent.plist

# Removes the 5.1 KBox agent

sudo /Library/StartupItems/KBOXAgent/KBOXAgent stop
sudo /Library/KBOXAgent/Home/bin/kagentctl stop 2>&1
sudo /Library/KBOXAgent/Home/bin/SMMPctl stop 2>&1
sudo rm -rf /Library/KBOXAgent
sudo rm -rf /Library/StartupItems/KBOXAgent
sudo rm -rf /Library/Receipts/KBOX\ Agent.pkg
sudo rm -rf /var/kace
sudo rm -rf /var/db/receipts/com.kace.kboxagent.bom
sudo rm -rf /var/db/receipts/com.kace.kboxagent.plist
sudo rm -rf /Library/LaunchDaemons/kace.smmpagent.bootup.plist

Update 3-7-2012: I’ve updated this script to accomodate uninstalling both 5.1.x agents and 5.3.x agents. The updated script and script-only uninstaller is posted here on my GitHub repo for download.

  1. Reed L
    September 23, 2011 at 1:37 am

    I was excited to see this issue mentioned by you on MacE, because I see the same behavior intermittently at our office. However, this didn’t seem to work. The only thing I changed was that I rm -Rf’ed /var/kace/SMMP instead of the whole /var/kace, as I have been asked to preserve the kuid.txt file for tracking purposes.

    Oh well.

    I’ve opened a ticket with KACE on this, not sure if there would be any point, but is there a ticket # of yours I could reference?

    Also, any tips on getting checkin and AMP more reliable? Reopening a ticket on that also…

    • September 23, 2011 at 1:52 am


      Sorry, I don’t have an existing ticket to reference on this issue. For the agent removal, you could try backing up the kuid file to another location before removing /var/kace, then restoring it when you reinstall the agent. I’ve found the reinstallation works fine if *everything* is removed.

      My usual uninstall/reinstall procedure works like this:

      1. Uninstall client
      2. Reboot Mac
      3. Reinstall client

      In truth, I haven’t seen issues in my own shop with check-ins or AMP. The main issue I’ve had is when the agent breaks and the login hangs as a consequence.

  2. wer
    July 10, 2018 at 2:53 am

    you fool.. the space in this command has accidentally deleted my entire Applications folder…

    sudo rm -rf /Library/Application\ Support/Dell

  1. No trackbacks yet.

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 )

Connecting to %s

%d bloggers like this: