Reputation: 1
I have retrieve all the users in a groups if the group contains nested groups i am trying to iterate over them separately and getting the users using another method.
What if the nested group again contains another nested group it would be redundant to create another method to fetch users again
I want to get all the users of a group including the nested group advise
Thanks in Advance
Upvotes: 0
Views: 1232
Reputation: 11056
If I understand what you are trying to accomplish, perhaps you should try a query like:
(memberOf:1.2.840.113556.1.4.1941:=CN=GroupOne,OU=Security Groups,OU=Groups,DC=YOURDOMAIN,DC=NET)
This will Resolve all members (including nested) security groups (requires at least Windows 2003 SP2). You could then inquire if they are users or Groups.
A query like:
(&(objectClass=user)(memberof:1.2.840.113556.1.4.1941:=CN=GroupOne,OU=Security Groups,OU=Groups,DC=YOURDOMAIN,DC=NET)
Will retrieve only user that are members of a group.
Upvotes: 0
Reputation: 4503
You need to look at the tokenGroups
attribute of the user account. Here's a blog post that might get you started - http://blogs.msdn.com/b/alextch/archive/2007/06/18/sample-java-application-that-retrieves-group-membership-of-an-active-directory-user-account.aspx
Upvotes: 1