Finding all members of one AD group in asp.net -- Urgent!


J

Jay

Good morning,

I admit, I'm stuck any help in this would be greatly appreciated. I have a
searcher.filter that is currently pulling all objects of type 'person' from
my Active Directory, but I just need members of a particular group. My
problem is that I can't find proper documentation on how to do this nor any
good examples?

I currently have the following as my AD search method:

'Get all users in the G_SCA_CHANGE_CONTROL group
Dim entry As New DirectoryEntry("LDAP://SCA")
Dim searcher As New DirectorySearcher(entry)
Dim result As SearchResult
Dim results As SearchResultCollection
Dim CCGroup As String = "G_someglobal_group"
searcher.Filter = String.Format("(&(objectCategory=person))") 'This is the
line I need to get all 'person' from group CCGroup
searcher.PropertiesToLoad.Add("samAccountName")
searcher.SearchScope = SearchScope.Subtree
results = searcher.FindAll
searcher.Sort.Direction = SortDirection.Ascending
For Each result In results
txtADUserGroup.Text = txtADUserGroup.Text &
result.Properties("samAccountName")(0).ToString() & vbNewLine
Next

Like I said, I just need syntax (or a reference to) for the searcher.filter
to only get users from the ccgroup as defined above.

Thanks in advance,

Jay
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top