1

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.

Simon
  • 111
  • 1
  • 4

1 Answers1

2

See "dsget group /?" for an example.

dsget group "CN=DL1,OU=Whatever,DC=Domain,DC=Com" -members -expand

The above should work. But it will spit nested DL names along with members of them.

maweeras
  • 2,734
  • 2
  • 17
  • 23