Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help me get started with the ldap

Status
Not open for further replies.

tractng

MIS
Sep 26, 2005
21
US
Guys,

I am looking to connect to AD and pull some of the following information from it.

I am looking to get First Name, Last Name, Phone Number etc.

One of the criteria is to look at the "Member of" and determine if he/she is a member of the F-Accounting or F-MHR.

Then output the result into a csv file in the following format below.

"Bob","Dole", "991-888-3211","MHR", " "

The "Accounting" or "MHR" will be static derived from the F-Accounting or F-MHR in the member of group. Also if there is any blank field in the Phone Number field or any field, it will still have quotation " " in between.

Thanks a lot.
tnt




I have looked at this sample script from MS and wonder why they didn't need a password/username to connect to AD

----------------------------------------------
On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000

objCommand.CommandText = _
"<LDAP://dc=fabrikam,dc=com>;(&(objectCategory=User)" & _
"(!(telephoneNumber=*)));Name;Subtree"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top