plumyeti Posted June 26, 2023 Posted June 26, 2023 Any suggestions on a script or something I can run via Jamf to clear some space? Delete users that are 30 days or older etc.....
3s-gtech Posted June 26, 2023 Posted June 26, 2023 -Open Terminal on an affected machine: -Type: -cd /Users -sudo rm -rf name* (to delete all 'name' users for instance) -It'll ask for the admin password. Certain versions of MacOS eat disk space. It's a bug.
Face-Man Posted June 26, 2023 Posted June 26, 2023 I've had to do this on mac with small Hard drives you might find first listing the contents on the users folder in date order by using ls -lt them you can remove the oldest folders from the bottom of the list
2ilent8cho Posted June 26, 2023 Posted June 26, 2023 (edited) This is the script I run on boot with JAMF on our IT Lab Mac's to delete the local user profiles. You should be able to adapt to what you need. The code does not put things on new lines correctly when posted, so I've attached a screenshot of it formatted correctly. sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow PasswordExpirationDays 0Users_Array=( `ls /Users | grep -v Shared | grep -v localadmin` )for user in "${Users_Array[@]}"do if [ "${user}" == "${User_Name}" ]; then echo "skip user ${user} as they are logged on." else dscl . -delete /Users/${user} rm -fR /Users/${user} fidone Edited June 26, 2023 by 2ilent8cho
plumyeti Posted June 27, 2023 Author Posted June 27, 2023 (edited) This is the script I run on boot with JAMF on our IT Lab Mac's to delete the local user profiles. You should be able to adapt to what you need. The code does not put things on new lines correctly when posted, so I've attached a screenshot of it formatted correctly. [ATTACH=CONFIG]69311[/ATTACH] sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow PasswordExpirationDays 0Users_Array=( `ls /Users | grep -v Shared | grep -v localadmin` )for user in "${Users_Array[@]}"do if [ "${user}" == "${User_Name}" ]; then echo "skip user ${user} as they are logged on." else dscl . -delete /Users/${user} rm -fR /Users/${user} fidone Definitely want something like this but only if 30 days or older. Don't want to delete students active garage band projects! Edited June 27, 2023 by plumyeti
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now