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?