Last active
March 31, 2017 18:17
-
-
Save opragel/8fa1015d9f4e2a3ea6ba30c087c2664f to your computer and use it in GitHub Desktop.
sad_mdm.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# dangerous, your funeral | |
# shoutout to rtrouton for jss comm checks | |
jamf_binary=$(/usr/bin/which jamf) | |
jss_comm_chk=$("$jamf_binary" checkJSSConnection > /dev/null; echo $?) | |
if [[ "$jss_comm_chk" -gt 0 ]]; then | |
/usr/bin/printf "Machine cannot connect to the JSS. Exiting." | |
elif [[ "$jss_comm_chk" -eq 0 ]]; then | |
/usr/bin/printf "Machine can connect to the JSS. Fixing MDM" | |
"$jamf_binary" removeMdmProfile -verbose | |
/usr/bin/profiles -D -f -v | |
# uncomment line 17 & 18 to | |
# nuke from orbit | |
# it's the only way to be sure | |
rm -rf "/Library/Keychains/apsd.keychain" | |
rm -rf /var/db/ConfigurationProfiles/* | |
"$jamf_binary" mdm -verbose | |
"$jamf_binary" mdm -userLevelMdm -verbose | |
"$jamf_binary" recon -verbose | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment