Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Get All Domain Users?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xenophon - 05 Jan 2006 23:49 GMT
I am working with a Windows 2003 native domain, users are in Domain
Local Groups, Global Groups, and Local Groups. Users are not all
lumped into the "users container".

Is there a way to query a DC for all users, regardless of their
container/location? In the NT days of the flat SAM, this would be
relatively easy.

I am currently using ADSI and LDAP queries with C# to get things in
individual containers, but I need a "global get".

Thanks.
"Peter Huang" [MSFT] - 06 Jan 2006 05:56 GMT
Hi Xenophon,

You can take a look at the link below.

Querying Microsoft Active Directory Using Microsoft .NET Framework Library
http://www.codeproject.com/dotnet/QueryADwithDotNet.asp

All Users
The last query I want to discuss in this article is meant to return a list
of all the AD domain users.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Marc Scheuner [MVP ADSI] - 06 Jan 2006 05:57 GMT
>I am working with a Windows 2003 native domain, users are in Domain
>Local Groups, Global Groups, and Local Groups. Users are not all
>lumped into the "users container".
>Is there a way to query a DC for all users, regardless of their
>container/location?

Sure - have a look at the DirectorySearcher class in
System.DirectoryServices.

What you need to do is specify the domain level as your search root
(LDAP://dc=yourcompany,dc=com), a filter to pick the users, and then
call the .FindAll() method to get all users.

If you expect to get back more than 1000-1500 users, you'll also need
to set the .PageSize property of the DirectorySearcher to a value
other than zero, e.g. 1000, to allow AD to do "paged searches" and
return all users.

HTH
Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.