zonkerman
asked on
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://myA DNodePath" )
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(aSearch Result.Pat h)
Next
Dim aADE As New DirectoryEntry("LDAP://myA
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(aSearch
Next
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.