Remove MCX from a select group of Macs

Contributor III

Hello, I've got the need to remove MCX management from a select group of 10.8 Macs. We have 39 or so MCX preferences scoped to both 10.7 and 10.8 Macs in our production environment.

These Macs will be added to a dev environment, but can't be re-imaged. The JSS in this dev environment does not have any MCX preferences set up.

Is there a way (through terminal preferable) to un-manage MCX on these Macs?

any advise would be appreciated.

Thank you!


Contributor III

remove them from the scope assigning the mcx in the first place, then try something like a:

dscl . -mcxdelete /computers/localhost

and see if that does the trick.

New Contributor III

See a post i started recently with a similar issue. The response was effective in removing the MCX from the machines.

Contributor III

Thank you for the responses. I've successfully removed computer level management using the commands you provided. However after login with existing users, /Library/Managed Preferences/[username] is re-generated. As a troubleshooting step I removed caper from a test system and the issue of /Library/Managed Preferences/[username] coming back after a login persist. Is there any way to prevent this from coming back?

Thank you!

The script I threw together is:


declare -x logFile="/Library/Logs/removeMCX.log"

# sends all standard output and standard error to log file.
exec >> $logFile
exec 2>&1

echo "Remove Computer Management"
echo "sudo dscl . -mcxdelete /computers/localhost"
    sudo dscl . -mcxdelete /computers/localhost
echo "rm -rf /Library/Managed Preferences"
    rm -rf /Library/Managed Preferences

echo "Remove Management for Casper"
    sudo dscl . -delete /Users/casper dsAttrTypeStandard:MCXSettings
echo "sudo dscl . -delete /Users/casper dsAttrTypeStandard:MCXSettings"

echo "Remove Management for NXFIX"
echo "sudo dscl . -delete /Users/nxfix dsAttrTypeStandard:MCXSettings"
    sudo dscl . -delete /Users/nxfix dsAttrTypeStandard:MCXSettings

echo "Remove Management for each user"
for i in /Users/*
 u=`echo $i | cut -d/ -f3`
 case $u in
    echo "sudo dscl . -delete /Users/"$u" dsAttrTypeStandard:MCXSettings"
    sudo dscl . -delete /Users/"$u" dsAttrTypeStandard:MCXSettings
    echo "sudo dscl . -delete /Users/"$u" MCXSettings"
    sudo dscl . -delete /Users/"$u" MCXSettings
    echo "sudo dscl . -delete /Users/"$u" MCXFlags"
    sudo dscl . -delete /Users/"$u" MCXFlags
    echo "sudo dscl . -delete /Users/"$u" cached_groups"
    sudo dscl . -delete /Users/"$u" cached_groups
    echo "rm /Users/"$u"/Library/Preferences/"
    rm /Users/"$u"/Library/Preferences/
    echo "sudo dscl . -mcxdelete /Users/"$u""
    sudo dscl . -mcxdelete /Users/"$u"
exit 0