PDA

View Full Version : LDAP Acess


mdlister
08-21-2006, 12:53 PM
I have been given a vbs script that pulls off a list of printers from Active directory. I have converted the output to list the data. however i get the error message

Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/listprinters.asp, line 16

anyone know what i am doing wrong?

************* CODE *********************

<%

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

Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select printerName, serverName from " _
& " 'LDAP://DC=PRINCESS-YACHTS,DC=com' where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF
response.write("Printer Name: " & objRecordSet.Fields("printerName").Value & "Server Name: " & objRecordSet.Fields("serverName").Value)
objRecordSet.MoveNext
Loop

%>

****************************************

Line 16 is: objRecordSet.MoveFirst

i need to pull off the information and then dump it into a database. any help would really help or any other ideas??