943,808 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 34021
  • C# RSS
May 15th, 2008
0

Get Users from Windows Active Directory

Expand Post »
Hi,
Can anyone let me know how to list all the users from a windows active directory using C#.

thanks.
santosh.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
santoo is offline Offline
17 posts
since Nov 2006
Jul 9th, 2008
0

Re: Get Users from Windows Active Directory

UP


How to list users , IPs on Windows server using C#


Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Eng_Gaza is offline Offline
4 posts
since Jul 2008
Jul 9th, 2008
0

Re: Get Users from Windows Active Directory

Click to Expand / Collapse  Quote originally posted by santoo ...
Hi,
Can anyone let me know how to list all the users from a windows active directory using C#.

thanks.
santosh.
Hi,
First include System.DirectoryServices.dll.

Then try this code
C# Syntax (Toggle Plain Text)
  1. DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);
  2. string userNames="Users : ";
  3. foreach (DirectoryEntry child in directoryEntry.Children)
  4. {
  5. if (child.SchemaClassName == "User")
  6. {
  7. userNames += child.Name + Environment.NewLine ;
  8. }
  9.  
  10. }
  11. MessageBox.Show(userNames);
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Need Your help please
Next Thread in C# Forum Timeline: C# connect to PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC