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
  DOMAIN.ESTBALISHMENT.EDU
    LEVEL1A
      LEVEL2A
        COMPUTERS
        USERS
        GROUPS
        OFFICES
    LEVEL1B
      LEVEL2B
        ....

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 ??)

thanks
LVL 8
plqAsked:
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.

DrWarezzCommented:
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.
[r.D]
0
terrygreensillCommented:

Hi paul

You need to include

LDAP://domain.establishment.edu/OU=USERS,OU=LEVEL2A,ou=LEVEL1A,DC=DOMAIN,DC=ESTBALISHMENT,DC=EDU

Hope this helps let me know how you get on


0

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
0
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.

Debsyl99Commented:
Hi
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
http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/techref/en-us/Default.asp?url=/Resources/Documentation/windowsserv/2003/all/techref/en-us/w2k3tr_adsrh_how.asp
The Script Repository (MS)
http://www.microsoft.com/technet/scriptcenter/default.mspx
The Script Center Script Repository
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx
Script Repository: Active Directory User Accounts
http://www.microsoft.com/technet/scriptcenter/scripts/ad/users/default.mspx

Deb :))
0
terrygreensillCommented:
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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/user_object_attributes.asp
0
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.
0
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.