| | |
list all security groups in active directory
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 115
Reputation:
Solved Threads: 6
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:
but all want all the confugred security groups/users
wondered if anyone had any ideas?
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:
VB.NET Syntax (Toggle Plain Text)
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?
Please mark this post as 'Solved' if it has helped and fixed your issue.
![]() |
Similar Threads
- Get Users from Windows Active Directory (C#)
- Adding user and mailbox in Active Directory (Python)
- Active Directory based Intranet web application problems (ASP.NET)
- Active Directory 2003 Script (Python)
- how to sort out 'active directory cannot be found in cache' error (Visual Basic 4 / 5 / 6)
- Integrating with Active Directory (OS X)
- Active Directory (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: Text Analysis
- Next Thread: ListView DoubleClick wont fire
| Thread Tools | Search this Thread |
"crystal .net .net2005 2008 access add advanced application array assignment basic beginner box button buttons center click client code combo convert cpu data database datagrid datagridview designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees excel exists firewall forms html image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity pan picturebox picturebox2 port print printpreview record regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase sqlserver storedprocedure string temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml





