Understanding Active Directory Select Statements

I've got this query which selects data from a customers active directory, but its only returning certain top level information

Problem is, I don't really understand all about OU=, DN= etc etc

The customers directory shows like this in windows explorer

Active Directory Users and Computers

The query which is

   Select PersonalTitle, Displayname, UserPrincipalName, sAMAccountName, ADsPat FROM 'LDAP://domain.establishment.edu'

I am running this from VB Script. Its bringing back users I don't want and lots of other info, but apart from that and its working fine,

1. how can I change the bit in quotes to only return USERS from LEVEL2A ?
2. Any more information on what OU=, o=, c=, cn= etc means would be great.
3. Any ideas on how I can find out what fields names are available in the select statement (I get the feeling they vary by installation ??)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hey Paul,
I don't use VB (don't get me started ;-) ). Anyways, I'm pretty sure that you're get a much better, quicker response if you ask this Q in the VB section: www.experts-exchange.com/VB should redirect you to the right place :-)

good luck with it - and soz I can't help further.

Hi paul

You need to include


Hope this helps let me know how you get on


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
plqAuthor Commented:
Bang on. Thanks.

Any ideas on the point 3 above ? How to query the AD for field names ? If they're fixed I just need a list, if they're not fixed I just need to know how to query the AD and I don't mind if its a manual task or programming task
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Some pretty general links, but if you have some scripting experience then these are worth a look, as they'll give you some insight into querying AD,
How Active Directory Searches Work
The Script Repository (MS)
The Script Center Script Repository
Script Repository: Active Directory User Accounts

Deb :))
These are called user object attributes and are fixed within a standard AD schema.

there are

User naming attributes
user security attributes
user address attributes

See link for details

plqAuthor Commented:
Big thanks to everyone for helping. Points to terry for answering completely, but thanks also to debsyl99 for the useful additional links which hopefully make this thread more useful to future readers.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.