Created
January 27, 2018 07:50
-
-
Save lucascantor/5390619ac45edae2904a9435c7cd78bc to your computer and use it in GitHub Desktop.
Demote all admin users to standard users, excluding a specified exempt local admin user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
localAccts=$(dscl . list /Users UniqueID | awk '$2>500{print $1}' | grep -v <exempt username>) | |
while read account; do | |
echo "Making sure $account is not an admin" | |
dseditgroup -o edit -d $account admin | |
done < <(echo "$localAccts") | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment