Dsquery nested groups

Posted by Doctor Trout on Server Fault See other posts from Server Fault or by Doctor Trout
Published on 2010-12-14T15:17:54Z Indexed on 2011/01/08 2:55 UTC
Read the original article Hit count: 342

Filed under:
|

Hi there,

How would I write a dsquery to get a list of all the members of a d-list, expanding any nested groups to get the members of those groups?

I've written this:

dsquery * -filter "(&(memberOf=cn=...))" -r -limit 0 -attr 
CUSTOMFIELD sAMAccountName displayName > export.txt

but returns nested d-lists and I want to expand these.

I then tried this:

dsquery group -samid "NAME | dsget group -members -expand > export.txt

But this just lists the OU of each member and I want to get the Account Name and a custom field returned.

Is there any way, either of chosing which fields to return from dsget or to epxand dsquery to show nested group membership?

Thanks.

© Server Fault or respective owner

Related posts about active-directory

Related posts about dsquery