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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to LDAP (edir) server to query database VBSCRIPT

Status
Not open for further replies.

tyant

Programmer
Jun 1, 2001
68
AU
Trying to connect to LDAP server using a vbscript to pull information out

This is what I have. Get error when get to recordset

Error = line 24
either BOF or EOF is True, or the current record has been deleted. Requester operation requires a current record



Const ADS_SCOPE_SUBTREE = 2

strNDSUserName="cn=user,ou=orgunit,ou=orgunit,o=root"
strPassword="password"

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = strNDSUserName
objConnection.Properties("Password") = strPassword
objConnection.Open "ADSI"

Set objCommand.ActiveConnection = objConnection


objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE



objCommand.CommandText = _
"SELECT AdsPath FROM 'LDAP://server/ou=orgunit,o=root' WHERE objectlass='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("userobject").Value
objRecordSet.MoveNext
Loop
 
>objRecordSet.Fields("userobject").Value
There is no such userObject attribute returned from the sql to begin with, and no such attribute in the ad user objectClass neither.
 
usereobkect is an example of what I am looking for. I know the attribute names. The connection to the LDAP Directory is not working. It's not Active Directory, its eDirectory.
 
So it has "userObject" attribute. And it doesn't need to return from the command which only has adspath. You think it is fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top