Troubleshooting Code Error 80040E37 - Table does not exist
Error 80040E37 literally means there is something wrong with the LDAP domain database table. However, in
practical terms, most likely there is a syntax error in the LDAP:/domain line.
Introduction to Error Code 80040E37
This error code, 80040E37 occurs when you execute a VBScript. You are
probably using a WSH method to connect to LDAP. My guess is that there is a mistake with the speech marks.
The Symptoms you get
The script does not manipulate the Active Directory object as you had hoped, instead you get a Windows Script Host error message. The probably scenario is that you are trying to manipulate an LDAP
object.
The Cause of Code Error 80040E37
Incorrect reference to the domain in an LDAP command. In this
context 'Table' refers to a domain in line such as: LDAP://domain.
Check the Line in your script that references the 'Provider'. If
necessary, work back for previous LDAP occurrences.
Char 1: often lies! it just means that the whole line will not execute. In
the case of runtime errors you can use this work around. Add this line:
On Error Resume Next
Example of Script
Note the error is actually on line 15: it should be 'LDAP://DC=CP,DC=Com'. I could not get it to work with the strDomain variable; until Bruce M. kindly wrote in with the following correction.
If there is a message here it is pay careful attention to the single and double quotes.
Be advised that your error will be different, just apply the general principels and try different arrangements of speech marks.
Mistake line 15 & " 'LDAP://' & strDomain where objectClass='printQueue'"
Correct line 15 to read : & " 'LDAP://" & strDomain & " ' where objectClass='printQueue' "
' 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
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://' & strDomain 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
Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
objRecordSet.MoveNext
Loop
' End of Example 80040E37
Try
a different solution, download SolarWinds ipMonitor
Here is my thinking,
ipMonitor will give you valuable data about your network and servers.
This extra information just may unlock the solution to your error code.
One more thing, sometimes when troubleshooting you go around in circles;
therefore if you try a different, but related approach, you may just crack the
problem.
Free Download
of SolarWinds ipMonitor
Their topics and material are ideal for getting you started with VBScript. The
videos are easy to follow and you can control the pace. Try their free demo material and then see if you want to buy the full package.
See more about VB Script Training CD.