Check that active directory group exists...

lidds

Well-known member
Joined
Oct 19, 2004
Messages
122
Programming Experience
Beginner
I want to let the user enter a active directory group, and I want to verify that the group they entered does exist. However I am not sure how to do this, I assume it is something simular to the below code:

VB.NET:
        Dim de As DirectoryEntry = New DirectoryEntry(Me.strDomain)
        Dim deSearch As DirectorySearcher = New DirectorySearcher()
        deSearch.SearchRoot = de
        deSearch.Filter = "<enter group filter syntax>" & myGroupName & ")"
        Try
            Dim results As SearchResultCollection = deSearch.FindAll()
            If results.Count = 0 Then
                Return False
            Else
                Return True
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

Thanks

Simon
 
Back
Top