So we have Macbooks with dual accounts 501 is "company admin" and 502 is "assigned user" currently with admin rights thats needs to be changed to standard. I used this script and it worked like a champ:
!/bin/bash
while read useraccount; do
/usr/sbin/dseditgroup -o edit -d $useraccount -t user admin
done < <(dscl . list /Users UniqueID | awk '$2 >= 502 {print $1}')
exit
Problem is that in some cases the UID is flipped and 502 is the "company admin" and s a result I (the admin) locked myself out of a few macs.
What would be the best way to script this so that it changes the active user logged in at the time without regard to the UID? I've tried several variations and come up with nothing productive.
