Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I'm working on a program that needs to read a list of PC's from Active Directory a few levels down in the OU structure.

The AD path I would need to access is this:

company.com - Divison1 - Site1 - Computers

Division 1, Site1 and Computers are all OUs.

Problem is any tutorials I have found online show how to read only ALL PC's from Active Directory. That would amount to over 22,000 PCs in my company.

I need to read all PC's from the 'Computers' OU in the above path or at least all computers in the 'Site1' OU using VB.net


Could someone point me in the right direction here or provide code samples for accomplishing this?

Many Thanks.
Posted

1 solution

In all of those examples, they all connect to a domain controller with a path something like: 'LDAP://DC=fabrikam,DC=com'. You should just have to be more specific and expand that path to include the OU path: 'LDAP://OU=someContainer,DC=fabrikam,DC=com'. Note, using a path like this limits your results. You cannot use RDN's.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900