Listing Users Present in More Than One Group

Dim DomainContainer As IADsContainer
Dim Members As IADsMembers
Dim User As IADsUser
Dim Group As IADsGroup
'Bind to the known domain.
'Here DomainName is your domain name.
Set DomainContainer = GetObject("NTDS://DomainName")
'Enumerate those Users in domain "DomainName" which are members of more
'than one group. Print their names in debug window.
'Notice how you can say "For Each Group In Members"
'IADsMembers allows you to enumerate objects in non container classes like
DomainContainer.Filter = "User"
For Each User In DomainContainer
Set Members = User.Groups 'Returns an IADsMembers object
If Members.Count > 1 Then
Debug.Print User.Name & " belongs to " & Members.Count; " Groups..."
For Each Group In Members
Debug.Print " " & Group.Name
Next Group
End If
Next User