User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 423,566 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,641 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 2341 | Replies: 2
Reply
Join Date: Nov 2006
Posts: 17
Reputation: santoo is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
santoo santoo is offline Offline
Newbie Poster

Get Users from Windows Active Directory

  #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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2008
Posts: 4
Reputation: Eng_Gaza is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Eng_Gaza Eng_Gaza is offline Offline
Newbie Poster

Re: Get Users from Windows Active Directory

  #2  
Jul 9th, 2008
UP


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


Thanks
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 454
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 78
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: Get Users from Windows Active Directory

  #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);
  12.  
KSG
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 6:45 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC