Mombu the Microsoft Forum

Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > LDAP query
REGISTER NOW! Mark Forums Read




Reply
 
Thread Tools Display Modes
1 18th April 20:28
steffen meier
External User
 
Posts: 1
Default LDAP query



Hi,

I need to perform a query (LDAP) against ADS.
I want to search for a user in ADS and retrieve some information about this
user from ADS-attributes.

I use the following VBS code, bascially this code works, however it seems
that I can only to a LDAP-search for a user using the DisplayName (?)

Currently I use the following command:
GetObject("LDAP://cn=Joe-Developer,cn=Users," &
objRootDSE.Get("defaultNamingContext"))

OK.. this works, but what I need is to search for the "samUserAccount", or
FQ-name - so I tried something like this:
GetObject("LDAP://cn=User001,cn=Users," &
objRootDSE.Get("defaultNamingContext"))
and
GetObject("LDAP://cn=domain.com/Users/User001,cn=Users," &
objRootDSE.Get("defaultNamingContext"))

Doesnt work.

How could I do a query that seaches for samUserAccount ?

Thank you
'***
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objUser = GetObject("LDAP://cn=Joe-Developer,cn=Users," &
objRootDSE.Get("defaultNamingContext"))


strDisplayName = objUser.Get("displayName")
strMail = objUser.Get("Mail")
strDescription = objUser.Get("Description")
Dep = objUser.Department
Company = objUser.Company
Tel = objUser.Telephonenumber
account = objUser.SamAccountname

Wscript.Echo "Account : " & Account
Wscript.Echo "displayName: " & strDisplayName
Wscript.Echo "Mail : " & strMail
Wscript.Echo "Description: " & strDescription
Wscript.Echo "Department : " & Dep
Wscript.Echo "Company : " & Company
Wscript.Echo "Tel : " & Tel
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 26th April 04:11
asdf
External User
 
Posts: 1
Default LDAP query



Friday 13. today.

Good luck for an answer.

-------------------------------------------------------

Won't be your "Robinson Crusoe" companion today
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


Reply


Thread Tools
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666