Get groups an AD user belongs to via CLI? (dscl?)

Hello,

I'm trying to get a list of groups users in AD belongs to via the command line. I need to incorporate this into a script I'm writing.

I know I can get a list of groups via:
dscl dscl /Active\ Directory/All\ Domains -list /Groups
And I can get what users belong to them via:
dscl /Active\ Directory/All\ Domains -read /Groups/groupname

What I'd prefer is to get the group membership via the user instead... Such as
"John Doe is a member of:
-Group1
-Group2
-etc.."

Anyone have any ideas here?

The shell script I've written is for an AD to OD transition. The only thing I don't have in it is to get group membership for each user. There's a handfull of groups in AD that the users may belong to that I'd like to grab to transition them to the replacement OD group (e.g. ad_group1 => od_group1).

If anyone's got anything that might help, it'd be greatly appreciated 🙂 Thanks.

Mac OS X (10.6.5)

Posted on Dec 8, 2010 8:18 PM

Reply
1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Get groups an AD user belongs to via CLI? (dscl?)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.