How do I find all groups in common between a set of users in Active Directory?

Nothing fancy here.  For a given set of usernames, show me the common groups that they are *all* in.

EG; if I have a list of 20 usernames, I need to check all of their group memberships and find the common thread(s) that run between every user.

There are probably a dozen of ways to do this, but when presented with this task, my thoughts immediately went to “if I have a list of every users groups in one single list, for a group to be in common it must appear exactly the same number of times, as there are users being compared”.

Which turned into this:


Or, if your your source list of users needed to come from a get-aduser query:


Leave a Reply

Your email address will not be published. Required fields are marked *