• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

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
0
plq
Asked:
plq
2 Solutions
 
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
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now