MacOS – How to delete multiple users from OS X Yosemite

macosmobile-device-management

My tech put Yosemite on 39 iMac computers in my elementary computer lab last week. I have 800 students who come through it every week, and I need to delete the last 4 year's users (approx 100/machine). It takes forever to delete each user individually. Also, can I override the individual user settings for each student? Students occasionally use other machines and have to go through the set up process every time they get on a different machine. That will be irritating!

Best Answer

If you have no tools to manage scripts, you'll want to look into something like JumpCloud or OS X Server or Apple Remote Desktop.

Deleting users is quite trivial to script. Adding them back in is a little more tricky as they need to be created with proper settings and passwords.

dscl . -list /Users

The above command will list out all the users, so you can then filter out all the users you want to keep. Then you can pass the list of users to delete to:

dscl . -delete /Users/<whatever>

Finally, you can delete all user directories that are not remaining with a simple (and dangerous) rm -rf /Users/<whatever> command

Pretty much anything you can do by typing and clicking, you can script in Automator or script in myriad languages. Consider using a tool like Munki to automate installing apps. It can also be leveraged to run these management scripts as well as serve as a custom "App Store" for your school Mac lab.

Also, with 40 Macs, you will certainly have support from Apple. Reach out to your contact or call them. I'm sure someone from the small business team, retail team or education team can get you in touch with resources to learn and get your tech up to speed on Mac administration or help you select a more efficient/proficient tech for your needs.