Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Table Does not Exist on searching user name in AD

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2430
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Table Does not Exist on searching user name in AD
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Table Does not Exist on searching user name in AD - 3/22/2005 6:44:57 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Is there any difference in searching for user account in AD and computer account?

I am using similar queries in my WinPE environment. The search for computer account query works fine while the search for User query comes up with "Table does not exist message". Why?

Similar Queries except:
objectCategory = 'Computer' while searching for Computer Name
objectCategory = 'User' while searching for User Name

Set ADConnection = CreateObject("ADODB.Connection")
Set ADCommand = CreateObject("ADODB.Command")
ADConnection.provider = "ADsDSOOBject"
ADConnection.Properties("User ID") = "Domain\username"
ADConnection.Properties("Password") = "MyPassword"
ADConnection.Open "Active Directory Provider"
Set ADCommand.ActiveConnection = ADConnection

Query = "Select field1, field2 from '"
Query = Query + "LDAP://searchdomain=com,dc=com"
Query = Query + "' where objectCategory='user'"
Query = Query + " and samAccountName='"
Query = Query & VarUserNameToSearch
Query = Query + "'"

ADCommand.CommandText = Query
ADCommand.Properties("Page Size") = 100
ADCommand.Properties("Timeout") = 30
ADCommand.Properties("Cache Results") = False

Set ADRecordSet = ADCommand.Execute
 
 
Post #: 1
 
 Re: Table Does not Exist on searching user name in AD - 3/22/2005 6:47:42 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Also, how can I modify the query if searching for an user account within an OU in the root domain

Thanks

(in reply to aek)
 
 
Post #: 2
 
 Re: Table Does not Exist on searching user name in AD - 3/22/2005 6:49:13 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Computers are stored in a sub-container and user too

      

(in reply to aek)
 
 
Post #: 3
 
 Re: Table Does not Exist on searching user name in AD - 3/22/2005 7:12:55 AM   
  fosterr_2000

 

Posts: 65
Score: 0
Joined: 12/18/2004
From:
Status: offline
Her is what I use and it works. Note the ";subtree" at the end of the ldap statement.
This will search from the current context through all of it's sub-ou's.
Keep in mind that my LDAP query was wrapped by this forum editor but you will likely parse it up and build it as you did for yours.

Set objADOconnADSI = CreateObject("ADODB.Connection")
objADOconnADSI.Open "Provider=ADsDSOObject;"
Set objCommandADSI = CreateObject("ADODB.Command")
objCommandADSI.ActiveConnection = objADOconnADSI
objCommandADSI.Properties("Size Limit")= 10000
objCommandADSI.Properties("Page Size")= 10000
objCommandADSI.Properties("Sort on") = "sAMAccountName"
objCommandADSI.CommandText = "<LDAP://searchdomain=com,dc=com>;(objectClass=user);sAMAccountName,distinguishedname;subtree"
Set objRSADSI = objCommandADSI.Execute

(in reply to aek)
 
 
Post #: 4
 
 Re: Table Does not Exist on searching user name in AD - 3/22/2005 9:25:35 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
1. Always use & to concatenate strings instead of using +
2. Make sure your ldap path are correct. To search for users in a specific domain, simply include the ou in the ldap path as you would normally do when using getObject.

(in reply to aek)
 
 
Post #: 5
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 12:25:09 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
My query runs fine from my machine (coz I am already logged in the domain). But does not work in the WinPE environment.

The amazing part is that the same query works fine with the same credentials while searching for a specific computer acccount but comes with a "table does not exist" message while searching for Useraccount.

Could there be any possible credentials restrictions setting in AD where my user account is restricted to search or modify users but I am allowed to search computer accounts?

Is there any policy setting of that sort? Coz if there is, then I can forward my issue to the higer admins and then go from there.

Any other thoughts or ways to search for user account in WinPE mode??

Thanks

(in reply to aek)
 
 
Post #: 6
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 12:41:11 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
are you authenticated to the DC while in PE? Check out http://www.msfn.org/board/index.php
, they have a WinPE forum that could possibly provide info on this.

(in reply to aek)
 
 
Post #: 7
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 1:16:04 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
Thanks mbouchard.

Is'nt it just funny that as soon as I entered DC=DCName in my query that it worked just fine.

Just changed "LDAP://dc=searchdomain,dc=com"
to "LDAP://DC=DCName/dc=searchdomain,dc=com" and it worked fine.

But this brings me to the next question. In this specific test case, I have hardcoded the DCname, but can you get the name of the nearest DC in WinPE environment before logging to any domain.

This is what I had tried, but did not work for me.

Set MyDomain = GetObject("LDAP://RootDSE")
MyDC = MyDomain.Get("dnsHostName")

Then I tried to use the MyDC variable in the above LDAP search but this did not work in WinPE (works fine from my machine as I am already logged on the domain).

(in reply to aek)
 
 
Post #: 8
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 2:02:20 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
hmm.. Didn't we have this discussion before regarding selecting domains to authenticate if the local machine isn't of the domain ? I thought you already come up with ideas on that.

http://www.visualbasicscript.com/topic.asp?TOPIC_ID=2155

(in reply to aek)
 
 
Post #: 9
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 2:08:56 AM   
  aek

 

Posts: 29
Score: 0
Joined: 2/24/2005
From:
Status: offline
MI Bad. Thanks Token. Ya that was a workaround. Totally forgot.

:)

(in reply to aek)
 
 
Post #: 10
 
 Re: Table Does not Exist on searching user name in AD - 3/23/2005 2:59:48 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
No problem =)

(in reply to aek)
 
 
Post #: 11
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 3:15:09 AM   
  MasterOfTheHat

 

Posts: 6
Score: 0
Joined: 4/4/2005
From:
Status: offline
for a complete vbscript and AD scripting newb...

I've created a vbscript to rename PCs in a cmd-line supplied OU in a 2k3 AD environment. The script works fine if the OU supplied is under the root of the domain, but not if the OU is a subfolder of an OU on the root of the domain. The error I get is the same "Table does not exist" with error code of 80040E37 as in the topic.

Any ideas?

My LDAP is part of an SQL statement as follows:

      

I've also tried it as:

      
but I get the same results.

-MotH

(in reply to aek)
 
 
Post #: 12
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 3:32:33 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
It didn't work because when the LDAP path is incorrect. When you specify the path, it has to be the fully qualified path; starting from the very top of the domain hierarchy to the very bottom.
So you would need to specify "ou=level 2,ou=level 1,dc=cargohome,dc=com".

Replace:

objCommand.CommandText = "Select Name from 'LDAP://OU=" & strOUin & ",dc=cargohome,dc=com' " _
& "where objectClass='computer'"

with:
objCommand.CommandText = "<LDAP://" & strOUin & ",dc=cargohome,dc=com>;(objectClass=computer);
name;subtree"

where strOUIn is the fully qualified OU path instead of just the top or the bottom one.

(in reply to aek)
 
 
Post #: 13
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 3:45:00 AM   
  MasterOfTheHat

 

Posts: 6
Score: 0
Joined: 4/4/2005
From:
Status: offline
Awesome! So, by fully qualified, strOUin would be "ou=lvl1,ou=lvl2" or would something like "lvl1/lvl2" work?

(in reply to aek)
 
 
Post #: 14
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 6:14:17 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:
Originally posted by fosterr_2000

Her is what I use and it works. Note the ";subtree" at the end of the ldap statement.
This will search from the current context through all of it's sub-ou's.
Keep in mind that my LDAP query was wrapped by this forum editor but you will likely parse it up and build it as you did for yours.

Set objADOconnADSI = CreateObject("ADODB.Connection")
objADOconnADSI.Open "Provider=ADsDSOObject;"
Set objCommandADSI = CreateObject("ADODB.Command")
objCommandADSI.ActiveConnection = objADOconnADSI
objCommandADSI.Properties("Size Limit")= 10000
objCommandADSI.Properties("Page Size")= 10000
objCommandADSI.Properties("Sort on") = "sAMAccountName"
objCommandADSI.CommandText = "<LDAP://searchdomain=com,dc=com>;(objectClass=user);sAMAccountName,distinguishedname;subtree"
Set objRSADSI = objCommandADSI.Execute



you can use the
       tags (without the spaces) which helps with formatting

(in reply to aek)
 
 
Post #: 15
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 6:18:22 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
quote:
Originally posted by MasterOfTheHat

Awesome! So, by fully qualified, strOUin would be "ou=lvl1,ou=lvl2" or would something like "lvl1/lvl2" work?



It has to be "ou=lvl1,ou=lvl2".

(in reply to aek)
 
 
Post #: 16
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 7:10:11 AM   
  MasterOfTheHat

 

Posts: 6
Score: 0
Joined: 4/4/2005
From:
Status: offline
Still getting same errors...

      

where strOUin is "ou=script testing,ou=script testing1" (with quotes)

strLDAP then is "'LDAP://ou=script testing,ou=script testing1,dc=cargohome,dc=com'" (with single quotes and without double (") quotes)

(in reply to aek)
 
 
Post #: 17
 
 Re: Table Does not Exist on searching user name in AD - 4/4/2005 10:32:08 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
This is what I would use.

strOUin = "ou=script testing,ou=script testing1"
objCommand.CommandText = "<LDAP://" & strOUin & ",dc=cargohome,dc=com>;(objectClass=computer);
name;subtree"

What was the exact error message ?

(in reply to aek)
 
 
Post #: 18
 
 Re: Table Does not Exist on searching user name in AD - 4/7/2005 3:28:35 AM   
  MasterOfTheHat

 

Posts: 6
Score: 0
Joined: 4/4/2005
From:
Status: offline
Table does not exist. Code: 80040e37

(in reply to aek)
 
 
Post #: 19
 
 Re: Table Does not Exist on searching user name in AD - 4/7/2005 5:00:25 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Your ldap path is wrong. Check to make sure they reflect the actual object path.

Note that the most specific object is on the left and becomes less specific as you go to the right.

(in reply to aek)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Table Does not Exist on searching user name in AD Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts