Hello, I need to be able to take 150 mac book airs that have user with mobile accounts ran off ad turned into admins on only mac book airs. I want to keep them restricted on pc's
make ad user a local admin for 150 computers
Best answer by tlarkin
OK well I am stuck in my hotel room catching up on work and I am gonna toss you guys some free code. However, this is something I have most definitely posted on the old mailing list days, so if you searched for it you would probably find it.
So, this is what I would do:
1 - create a smart group in Casper by hardware model, scoped to this exact particular model of Macbook Air, since it is only going to apply to them.
2 - run a script at login, once per a computer that grabs all AD accounts and tosses them in the admin group. I actually have this script already written in my scripts repository (as I said I wrote this before I worked for JAMF).
#!/bin/bash
# generate local user account based on UID of greater than 1000, if multiple AD accounts exist this will grab all of them
userList=$(/usr/bin/dscl . list /Users UniqueID | /usr/bin/awk '$2 > 1000 { print $1 }')
for u in ${userList} ; do
/usr/sbin/dseditgroup -o edit -a ${u} -t user admin
done
exit 0
Now, if you want to leverage LDAP group membership, you should do so in your scope in Casper. Create your AD nested group of users that get these specific admin rights, and through scope limit the script to only run on machines that have users of that LDAP group. That way you aren't trying to create super crazy logic in your scripts, and you can leverage your simple drag and drop OU/Groups in AD.
So, if you have mapped your LDAP server for lookups in the JSS this is possible. You would assign it to all Macbook Airs of that specific model, and then fine tune that scope to only users who are member of _ LDAP group.
I hope this makes sense. Jet lagged and trying to stay awake to adapt to local time better.
-Tom
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
