Hi
Im trying to to simply list all security groups from active directory as i will then be doing checks on folders with the mathcing security group.
I can list all the users from active directory with this:
Dim myDirectoryEntry As DirectoryEntry = New DirectoryEntry(String.Format("LDAP://DC=domain,DC=org"))
Dim mySearcher As DirectorySearcher = New DirectorySearcher(myDirectoryEntry)
Dim mySort As SortOption = New SortOption("sn", SortDirection.Ascending)
mySearcher.Filter = ("(objectClass=user)")
mySearcher.Sort = mySort
For Each resEnt As SearchResult In mySearcher.FindAll()
Try
'If Not String.IsNullOrEmpty(resEnt.Properties("Mail")(0).ToString()) _
' AndAlso System.Text.RegularExpressions.Regex.IsMatch(resEnt.Properties("DisplayName")(0).ToString(), " |admin|test|service|system|[$]", System.Text.RegularExpressions.RegexOptions.IgnoreCase) Then
Dim space As Integer = resEnt.Properties("DisplayName")(0).ToString().IndexOf(" ")
Dim formattedName As String = String.Format("{0}{1}{2}", _
resEnt.Properties("DisplayName")(0).ToString().Substring(space).PadRight(25), _
resEnt.Properties("DisplayName")(0).ToString().Substring(0, space).PadRight(15), _
resEnt.Properties("Mail")(0).ToString() _
)
userList.Add(formattedName)
'End If
Catch
badEntries = badEntries + 1
End Try
Next
but all want all the confugred security groups/users
wondered if anyone had any ideas?