Re: Pulling Fields from LDAP
From: Marc Scheuner (mscheuner_at_mvps.org)
Date: 06/03/04
- Next message: Mike Brannigan [MSFT]: "Re: DNS and AD Question"
- Previous message: Eric Chamberlain, CISSP: "Re: How's everyone setup a Local and Global group name?"
- In reply to: John S: "Pulling Fields from LDAP"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 03 Jun 2004 08:12:55 +0200
>I would like to pull what I believe is the NT telephone number (General Tab on AD). I know this is an ADSI pull, but am I on the right track?
You could do it this way, yes - but if you want to phone number,
you'll have to specify it in the .CommandText !
>Sub CheckForUser(strUserName)
>objCommand.CommandText = "<LDAP://dc=xxxxxxx,dc=ins>;(&(objectCategory=User) (email=*)(samAccountName=" &strUserName& "));sAMAccountName,distinguishedName;subtree"
If you want the "phone", you have to add it to the list of attributes
to retrieve:
>objCommand.CommandText = "<LDAP://dc=xxxxxxx,dc=ins>;(&(objectCategory=User) (email=*)(samAccountName=" &strUserName& "));sAMAccountName,distinguishedName,phone;subtree"
Then, once you have the user, you will need to access the phone
attribute like any other attribute you've been selecting:
> If objRecordset.RecordCount <> 0 Then
> strsAMAccountName = objItem.Get("sAMAccountName")
> strTelephone = objItem.Get("phone")
Does this work?? (I'm not very fluent in VBScript.......)
>Also, is there a good documentation reference, that I can purchase?
What are you looking for?? A general AD programming guide? A AD
scripting guide?
Here are some recommendations:
Robbie Allen - Active Directory Cookbook
http://www.amazon.com/exec/obidos/ASIN/0596004648/qid=1086242916
Contains a lot of "how to" scripts and information - very highly
recommended
Inside Active Directory: A System Administrator's Guide
by Sakari Kouti, Mika Seitsonen
http://www.amazon.com/exec/obidos/tg/detail/-/0201616211
General purpose book on AD, with quite some technical insight
Active Directory Programming
by Gil Kirkpatrick (Author)
http://www.amazon.com/exec/obidos/tg/detail/-/0672315874
Very detailed, real programming, excellent tutorial book
Windows NT/2000 ADSI Scripting for System Administration
by Thomas Eck (Author)
http://www.amazon.com/exec/obidos/tg/detail/-/1578702194
Scripting / sys-admin oriented book, excellent stuff in there, too
HTH
Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
- Next message: Mike Brannigan [MSFT]: "Re: DNS and AD Question"
- Previous message: Eric Chamberlain, CISSP: "Re: How's everyone setup a Local and Global group name?"
- In reply to: John S: "Pulling Fields from LDAP"
- Messages sorted by: [ date ] [ thread ]