I am using the chain of commands to get a report of the members of group AD_GROUP_NAME.
dsquery group domainroot -name AD_GROUP_NAME | dsget group -members | dsget user -display -email
And it works great, unless the group has a group as a member. Then I get an error The object class of the target does not match the one specified on the command line.
Is there a command I could pipe the result of the dsget group - members
that will filter out the group objects from the returned results passing only users to dsget user
? Or even better, is there a way to recursively walk the results so I can get everyone who is in the group via inheritance?