dscl . list /Users | grep -v '^_'
dscacheutil -q user | grep -A 3 -B 2 -e name:/ aRoot
echo -n 'Password: '; read -s password
echo; echo; echo "entered password is '$password'"; echo; echo
sudo dscl . -create /Users/aRoot IsHidden 1
sudo dscl . -create /Users/aRoot UserShell /bin/bash
sudo dscl . -create /Users/aRoot NFSHomeDirectory /Local/Users/aRoot
sudo dscl . -create /Users/aRoot RealName 'ASB Admin'
sudo dscl . -create /Users/aRoot UniqueID 401
sudo dscl . -create /Users/aRoot PrimaryGroupID 400
sudo dscl . -passwd /Users/aRoot $password
sudo dscl . -append /groups/admin GroupMembership aRoot
dscl . -read /groups/admin GroupMembership
echo -n 'HostName: '
read hostname
sudo scutil --set HostName $hostname
sudo scutil --set LocalHostName $hostname
sudo scutil --set ComputerName $hostname
dscacheutil -flushcache
Some Additional Steps Before Removing MDM
# Get detailed user info on a aRoot user
dscl . -read /Users/aRoot
# List all admin users
dscl . read /Groups/admin | grep GroupMembership
# make the user an Administrator
sudo dscl . -merge /Groups/admin GroupMembership aRoot
# grab all users over UID 500
dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'
# changin password
echo -n 'Password: '; read -s password
echo; echo; echo "entered password is '$password'"; echo; echo
sudo dscl . -passwd /Users/aRoot $password