How can I get a list of groups in Active Directory and find out who is in those groups

I would like to be able to find out the names of all the active directory groups in my company and who is in those groups.  How would I do this using Visual Studio 2005 Visual Basic and .NET 2.0?   I tried with the below sample code but specifying "ou=Groups" does not do anything.  If I use something in the filter like sn=mar* then I do get the proper listing of names for the wildcard.  Maybe I should be using something other than "ou=" to find the groups?  I need a solution that uses VS 2005 Visual Basic and .NET 2.0

        Dim aADE As New DirectoryEntry("LDAP://myADNodePath")
        Dim aDS As New DirectorySearcher(aADE)
        Dim aSearchResult As SearchResult
        aDS .Filter = ("(ou=Groups)") '
        Dim aSRC As SearchResultCollection
        aSRC = aDS .FindAll()

        For I1 As Integer = 0 To aSRC .Count - 1
            aSearchResult = aSRC .Item(I1)
            ListBox1.Items.Add(aSearchResult.Path)
        Next
LVL 1
zonkermanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZavatarCommented:
Try objectClass=group
0
AkisCCommented:
       Dim strDomain As String = "youDomain.com", tmp As String = ""
        Dim Computer As Object, Group As Object
        Computer = GetObject("WinNT://" & strDomain)
        For Each Group In Computer
            If (Group.Class = "Group") Then
                tmp &= Group.Name & vbCrLf
            End If
        Next
        MsgBox(tmp)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.