Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get the MEMBERS of an ACTIVE DIRECTORY GROUP, and LIST the FULL NAMES and USERNAMES

Posted on 2006-07-10
8
Medium Priority
?
313 Views
Last Modified: 2010-04-23
Technologies: Windows Server 2003, Active Directory, Visual Basic .NET 2005, .NET Framework 2.0

I am writing an application that unlocks user accounts and resets their passwords. Performing those actions isn't a problem. However, to make the process more user-friendly, I am adding a drop-down box of users that can be used to find the user to unlock/change password.

The DropDown Box should show a list of the Full Names (John Doe, John Smith etc) of all the users of a Domain Group, but the actual values of the entries should be the logon name in Active Directory (john.doe, john.smith etc).

I want some way to connect to Active Directory, find the group (it is NOT Domain Users), list the members of the group (list both their Full Name and their username/logon name), and populate the Text & Value properties of the DropDown Box items with the entries from Active Directory.

Connecting to active directory is fine, as is databinding the DropDown Box, I basically just need to get a table with two columns, Username and Fullname, of all the members of a specified group.

Thanks in advance!
0
Comment
Question by:techxero
  • 4
5 Comments
 
LVL 11

Expert Comment

by:MacNuttin
ID: 17076268
0
 
LVL 11

Expert Comment

by:MacNuttin
ID: 17076286
0
 

Author Comment

by:techxero
ID: 17085052
Still can't work it out I'm afraid, does anyone have any code snippets?
0
 
LVL 11

Accepted Solution

by:
MacNuttin earned 2000 total points
ID: 17085252
This is from MSDN the link I sent you:
Try
' Bind to the users container.
Dim entry As New DirectoryEntry("LDAP://CN=users,DC=fabrikam,DC=com")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(entry)
' Create a SearchResultCollection object to hold a collection of SearchResults
' returned by the FindAll method.
Dim result As SearchResultCollection = mySearcher.FindAll()
' Create an object to hold a single result from the result collection.
Dim resEnt1 As SearchResult
' Get search results. For more information, see Getting Search Results.
'
' This sample uses Try...Catch to catch errors.
' Create an Exception object. For more information, see System.Exception.
Catch Else
    Dim exception As New System.Runtime.InteropServices.COMException()
    Console.WriteLine(exception)
Catch Else
    Dim InvOpEx As New InvalidOperationException()
    Console.WriteLine(InvOpEx.Message)
Catch Else
    Dim NotSuppEx As New NotSupportedException()
    Console.WriteLine(NotSuppEx.Message)

End Try
0
 
LVL 11

Expert Comment

by:MacNuttin
ID: 17220393
did you get your app to work?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question