1

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?

Tvanover
  • 257
  • 1
  • 3
  • 13
  • I'd rephrase the question as 'How can I generate a report of recursive group members displaying the member and their email address in the output? Here's what I've tried so far...' This way you'll get a lot more useful feedback with multiple solutions. Personally, I'd use the PowerShell Get-ADGroupMember cmdlet to accomplish this task, but offering that as a solution wouldn't answer your question. – twconnell Dec 14 '18 at 22:05

0 Answers0