table does not exist error in AD query?

  • Thread starter Aaron_TekRecycle.com
  • Start date
A

Aaron_TekRecycle.com

this runs perfectly as a .vbs but I'd like to convert it to an ASP... any
ideas?

Response.Buffer = True
Dim objConnection, objCommand, objRecordSet
Dim oPrinterName, oServerName

Const ADS_SCOPE_SUBTREE = 2
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=corp,DC=COMPANY,DC=com' where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Set oPrinterName = objRecordSet.Fields("printerName").Value
Set oServerName = objRecordSet.Fields("serverName").Value
Set oServerPrinter = "\\" & oServerName & "\" & oPrinterName

'Wscript.Echo "Printer Name: " & oPrinterName & vbcr & "Server Name: " &
oServerName (for .vbs)

' Display Printers on web page (for ASP)
Response.Write "Printer Name: " & oPrinterName
Response.Write vbcrlf
Response.Write "Server Name: " & oServerName

objRecordSet.MoveNext

Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top