Hi there,
I'm working on a script to wipe out student mobile accounts from our lab machines.
These machines are AD-bound, provisioning options are set to create mobile account at login with no confirmation.
Here's the script I'm running. As you can see, very simple because all our student accounts contain the "." character (e.g. john.doe) --
# list all users with the "." character in their names
USERS=$( dscl . ls /Users | grep -e "\\." )
# echo users
echo Deleting the following users: $USERS
# delete users
/usr/bin/dscl . delete /Users/"$USERS"
echo User accounts deleted
# delete home folders
/bin/rm -rf /Users/"$USERS"
echo User home folders deleted
The script successfully removes my test student account, but then I'm unable to re-add the student to the device from the login screen after a reboot, which will prevent students from being able to use the computers.
Any ideas where I could get more information on what is broken?
Alternatively, if there's a smarter way I should be doing this, I'm also open to that!
Thanks in advance