Mac – Bash – SCCM Agent – Uninstall

email me

Automatically remove the SCCM Agent using the CMUninstall, which can be found in the Mac SCCM Agent.

Normally, the uninstall requires user intervention:

 

This method does not require user intervention:


Step 1

Navigate to Tools > CMUninstall

 

Step 2

I recommend copying the CMUninstall into a dev or setup folder. I used Users > Shared > sccm_uninstaller

 

Step 3

Create a bash script, save as run.sh

#!/bin/bash

cd /Volumes
cd Mac*/Users/Shared/sccm_uninstaller
echo Y|./CMUninstall -c

 

Test Script

Open Terminal > drag script to Terminal > hit Return > script will run

 

Packaging

Now, if required, this bash script can easily be turned into a package, and then either manually ran, or deployed using SCCM (using a CMMac file) — Just remember to include the CMUninstall and the run.sh script in the package.

 

Notes

cd /Volumes
cd Mac*/Users/Shared/sccm_uninstaller

chmod o+x ./CMUninstall

DIR=”$( cd “$( dirname “${BASH_SOURCE[0]}” )” && pwd )”
cd ${DIR}

 

tags: Mac packaging, Mac automation, MrNetTek