I am looking for a script to remove admin access on 100 machines that are using AD accounts. We have a local admin that I want to remain, and be the only admin.
Any ideas?
I am looking for a script to remove admin access on 100 machines that are using AD accounts. We have a local admin that I want to remain, and be the only admin.
Any ideas?
Best answer by mm2270
What are they named? My script looks at all accounts in the 501 and up range and only excludes anything called "administrator" explicitly, so if they are called something else, that would be why it affected them. You need to change the grep -v to use whatever names you want to exclude, or, you could simply look at accounts with UIDs from 503 and up instead:
#!/bin/bash
while read useraccount; do
/usr/sbin/dseditgroup -o edit -d $useraccount -t user admin
done < <(dscl . list /Users UniqueID | awk '$2 >= 503 {print $1}')
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.