I wrote this script a while ago to clean off machines that were to be loaned out on a temporary basis. This works in 10.5 and I must warn you, it will delete everything in /Users. This is why I keep all my local admin accounts hidden away in /prviate/var.
Use at your own risk
[code]
#!/bin/bash
#loop through /Users and delete every account, ensure they are removed from the admin group and all data is gone
#this will completely scrub out /Users
for a in `/bin/ls /Users | grep -v “Shared”` ; do
#remove the account from admin group if applicable
/usr/bin/dscl . -delete /Groups/admin GroupMembership $a
#remove user from directory services, local
/usr/bin/dscl . -delete /Users/$a
#remove all user data
/bin/rm -rf /Users/$a
/bin/echo “done”
exit 0
[/code]
Use this at your own risk, and definitely test it out first.
Comments are closed