Get error trying to list published printers in AD

following script errors on line 13
table does not exist    code 80040E37

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=landam,DC=com' WHERE objectClass='printQueue'"
objCommand.Properties("Page Size") = 100
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
 Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
 Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
 objRecordSet.MoveNext
Loop
garylouisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sapbucketCommented:
which is line 13? looks to me like you have line wrap on.
0
garylouisAuthor Commented:
objCommand.CommandText = "SELECT printerName, serverName FROM " _
 & " 'LDAP://DC=landam,DC=com' WHERE objectClass='printQueue'"


figured it out should be

objCommand.CommandText = "SELECT printerName, serverName FROM " _
 & " 'LDAP://DC=landam,DC=landamerica,DC=net' WHERE objectClass='printQueue'"

used following to figure out -

 Get Domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = objRootDSE.Get("DefaultNamingContext")

WScript.Echo strDomain ' This is Extra line Guy put in to test

found on a great script error site -
http://www.computerperformance.co.uk/Logon/code/code_80040E37.htm
0
moduloCommented:
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.