| | |
list all security groups in active directory
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 114
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 |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dropdownlist excel fade file-dialog folder ftp generatetags google hardcopy image images input insert intel internet login mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





