Get Users from Windows Active Directory

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2006
Posts: 17
Reputation: santoo is an unknown quantity at this point 
Solved Threads: 0
santoo santoo is offline Offline
Newbie Poster

Get Users from Windows Active Directory

 
0
  #1
May 15th, 2008
Hi,
Can anyone let me know how to list all the users from a windows active directory using C#.

thanks.
santosh.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 4
Reputation: Eng_Gaza is an unknown quantity at this point 
Solved Threads: 0
Eng_Gaza Eng_Gaza is offline Offline
Newbie Poster

Re: Get Users from Windows Active Directory

 
0
  #2
Jul 9th, 2008
UP


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


Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Get Users from Windows Active Directory

 
0
  #3
Jul 9th, 2008
Originally Posted by santoo View Post
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
  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);
KSG
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC