![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Why isn't this LDAP query working on the other domain in the fores I'm executing a query against two different domains in the same forest (US and MX). The query for the domain I'm in (US) works fine. The other domain (MX) query returns 0 records. I do have security access to the other domain and I've changed the search parameters to the other domain. '*********CODE FOR MY DOMAIN (US) ********* Dim objConnection, objCommand Set objConnection = CreateObject ("ADODB.Connection") objConnection.Open "Provider=ADsDSOObject;" Set objCommand = CreateObject ("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.Properties ("Asynchronous") = True objCommand.Properties ("Cache Results") = True objCommand.Properties ("Page Size") = 10 objCommand.Properties ("Size Limit") = 100 Dim objRecordSet objCommand.CommandText = "<LDAP://dc=us, dc=fabrikam, dc=com>;(&(objectCategory=computer)(operatingSystem=Windows Server*));name;subtree" Set objRecordSet = objCommand.Execute While Not objRecordSet.EOF WScript.Echo objRecordSet.Fields ("name") & vbCr objRecordSet.MoveNext Wend objConnection.Close '*********CODE FOR DOMAIN THAT DOESN'T WORK (MX)********* Set objConnection = CreateObject ("ADODB.Connection") objConnection.Open "Provider=ADsDSOObject;" Set objCommand = CreateObject ("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.Properties ("Asynchronous") = True objCommand.Properties ("Cache Results") = True objCommand.Properties ("Page Size") = 10 objCommand.Properties ("Size Limit") = 100 objCommand.CommandText = "<LDAP://dc=mx, dc=fabrikam, dc=com>;(&(objectCategory=computer)(operatingSystem=Windows Server*));name;subtree" Set objRecordSet = objCommand.Execute While Not objRecordSet.EOF WScript.Echo objRecordSet.Fields ("name") & vbCr objRecordSet.MoveNext Wend objConnection.Close '*********END CODE ********* Is this a binding issue to the MX domain? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Why isn't this LDAP query working on the other domain in thefores Try to authenticate using username and password to ensure that the other domain know where to look for credentials. Larry wrote: Quote: > I'm executing a query against two different domains in the same forest (US > and MX). The query for the domain I'm in (US) works fine. The other domain > (MX) query returns 0 records. I do have security access to the other domain > and I've changed the search parameters to the other domain. > > '*********CODE FOR MY DOMAIN (US) ********* > Dim objConnection, objCommand > Set objConnection = CreateObject ("ADODB.Connection") > objConnection.Open "Provider=ADsDSOObject;" > > Set objCommand = CreateObject ("ADODB.Command") > objCommand.ActiveConnection = objConnection > objCommand.Properties ("Asynchronous") = True > objCommand.Properties ("Cache Results") = True > objCommand.Properties ("Page Size") = 10 > objCommand.Properties ("Size Limit") = 100 > > Dim objRecordSet > > objCommand.CommandText = "<LDAP://dc=us, dc=fabrikam, > dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > Server*));name;subtree" > > Set objRecordSet = objCommand.Execute > > While Not objRecordSet.EOF > WScript.Echo objRecordSet.Fields ("name") & vbCr > objRecordSet.MoveNext > Wend > > objConnection.Close > > '*********CODE FOR DOMAIN THAT DOESN'T WORK (MX)********* > Set objConnection = CreateObject ("ADODB.Connection") > objConnection.Open "Provider=ADsDSOObject;" > > Set objCommand = CreateObject ("ADODB.Command") > objCommand.ActiveConnection = objConnection > objCommand.Properties ("Asynchronous") = True > objCommand.Properties ("Cache Results") = True > objCommand.Properties ("Page Size") = 10 > objCommand.Properties ("Size Limit") = 100 > > objCommand.CommandText = "<LDAP://dc=mx, dc=fabrikam, > dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > Server*));name;subtree" > > Set objRecordSet = objCommand.Execute > > While Not objRecordSet.EOF > WScript.Echo objRecordSet.Fields ("name") & vbCr > objRecordSet.MoveNext > Wend > > objConnection.Close > > '*********END CODE ********* > > Is this a binding issue to the MX domain? -- -- HAL07, Engineering Services, Norway |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Why isn't this LDAP query working on the other domain in the fores Some info on alternate credentials that might help: http://www.rlmueller.net/ADOAltCredentials.htm -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- "HAL07" <yahoohal@xxxxxx> wrote in message news:ulle%23VEYJHA.5156@xxxxxx Quote: > Try to authenticate using username and password to ensure that the other > domain know where to look for credentials. > > Larry wrote: Quote: >> I'm executing a query against two different domains in the same forest >> (US and MX). The query for the domain I'm in (US) works fine. The other >> domain (MX) query returns 0 records. I do have security access to the >> other domain and I've changed the search parameters to the other domain. >> >> '*********CODE FOR MY DOMAIN (US) ********* >> Dim objConnection, objCommand >> Set objConnection = CreateObject ("ADODB.Connection") >> objConnection.Open "Provider=ADsDSOObject;" >> >> Set objCommand = CreateObject ("ADODB.Command") >> objCommand.ActiveConnection = objConnection >> objCommand.Properties ("Asynchronous") = True >> objCommand.Properties ("Cache Results") = True >> objCommand.Properties ("Page Size") = 10 >> objCommand.Properties ("Size Limit") = 100 >> >> Dim objRecordSet >> >> objCommand.CommandText = "<LDAP://dc=us, dc=fabrikam, >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows >> Server*));name;subtree" >> >> Set objRecordSet = objCommand.Execute >> >> While Not objRecordSet.EOF >> WScript.Echo objRecordSet.Fields ("name") & vbCr >> objRecordSet.MoveNext >> Wend >> >> objConnection.Close >> >> '*********CODE FOR DOMAIN THAT DOESN'T WORK (MX)********* >> Set objConnection = CreateObject ("ADODB.Connection") >> objConnection.Open "Provider=ADsDSOObject;" >> >> Set objCommand = CreateObject ("ADODB.Command") >> objCommand.ActiveConnection = objConnection >> objCommand.Properties ("Asynchronous") = True >> objCommand.Properties ("Cache Results") = True >> objCommand.Properties ("Page Size") = 10 >> objCommand.Properties ("Size Limit") = 100 >> >> objCommand.CommandText = "<LDAP://dc=mx, dc=fabrikam, >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows >> Server*));name;subtree" >> >> Set objRecordSet = objCommand.Execute >> >> While Not objRecordSet.EOF >> WScript.Echo objRecordSet.Fields ("name") & vbCr >> objRecordSet.MoveNext >> Wend >> >> objConnection.Close >> >> '*********END CODE ********* >> >> Is this a binding issue to the MX domain? > > -- > -- HAL07, Engineering Services, Norway |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Why isn't this LDAP query working on the other domain in the f Thanks for the help HAL07 and Richard. I'll try that and see what happens. I suspect it will work as "advertised". It's interesting that credentials have to be explicitly defined to the other domain. The trust relationship is there so this isn't exactly what I thought would be the issue. I don't have to explicitly define them when using the AD Users and Computers MMC for that domain. I'll have to track down more information on the authentication token and process to better understand this. "Richard Mueller [MVP]" wrote: Quote: > Some info on alternate credentials that might help: > > http://www.rlmueller.net/ADOAltCredentials.htm > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > "HAL07" <yahoohal@xxxxxx> wrote in message > news:ulle%23VEYJHA.5156@xxxxxx Quote: > > Try to authenticate using username and password to ensure that the other > > domain know where to look for credentials. > > > > Larry wrote: Quote: > >> I'm executing a query against two different domains in the same forest > >> (US and MX). The query for the domain I'm in (US) works fine. The other > >> domain (MX) query returns 0 records. I do have security access to the > >> other domain and I've changed the search parameters to the other domain. > >> > >> '*********CODE FOR MY DOMAIN (US) ********* > >> Dim objConnection, objCommand > >> Set objConnection = CreateObject ("ADODB.Connection") > >> objConnection.Open "Provider=ADsDSOObject;" > >> > >> Set objCommand = CreateObject ("ADODB.Command") > >> objCommand.ActiveConnection = objConnection > >> objCommand.Properties ("Asynchronous") = True > >> objCommand.Properties ("Cache Results") = True > >> objCommand.Properties ("Page Size") = 10 > >> objCommand.Properties ("Size Limit") = 100 > >> > >> Dim objRecordSet > >> > >> objCommand.CommandText = "<LDAP://dc=us, dc=fabrikam, > >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > >> Server*));name;subtree" > >> > >> Set objRecordSet = objCommand.Execute > >> > >> While Not objRecordSet.EOF > >> WScript.Echo objRecordSet.Fields ("name") & vbCr > >> objRecordSet.MoveNext > >> Wend > >> > >> objConnection.Close > >> > >> '*********CODE FOR DOMAIN THAT DOESN'T WORK (MX)********* > >> Set objConnection = CreateObject ("ADODB.Connection") > >> objConnection.Open "Provider=ADsDSOObject;" > >> > >> Set objCommand = CreateObject ("ADODB.Command") > >> objCommand.ActiveConnection = objConnection > >> objCommand.Properties ("Asynchronous") = True > >> objCommand.Properties ("Cache Results") = True > >> objCommand.Properties ("Page Size") = 10 > >> objCommand.Properties ("Size Limit") = 100 > >> > >> objCommand.CommandText = "<LDAP://dc=mx, dc=fabrikam, > >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > >> Server*));name;subtree" > >> > >> Set objRecordSet = objCommand.Execute > >> > >> While Not objRecordSet.EOF > >> WScript.Echo objRecordSet.Fields ("name") & vbCr > >> objRecordSet.MoveNext > >> Wend > >> > >> objConnection.Close > >> > >> '*********END CODE ********* > >> > >> Is this a binding issue to the MX domain? > > > > -- > > -- HAL07, Engineering Services, Norway > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Why isn't this LDAP query working on the other domain in the f I used your code for that and it resolved my problem. I also learned some new properties. I need to find that info on MSDN so I have all of the properties. Thanks for posting those spreadsheets too. That's a lot more convenient than working off the MSDN site and following links all over the place. "Richard Mueller [MVP]" wrote: Quote: > Some info on alternate credentials that might help: > > http://www.rlmueller.net/ADOAltCredentials.htm > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > "HAL07" <yahoohal@xxxxxx> wrote in message > news:ulle%23VEYJHA.5156@xxxxxx Quote: > > Try to authenticate using username and password to ensure that the other > > domain know where to look for credentials. > > > > Larry wrote: Quote: > >> I'm executing a query against two different domains in the same forest > >> (US and MX). The query for the domain I'm in (US) works fine. The other > >> domain (MX) query returns 0 records. I do have security access to the > >> other domain and I've changed the search parameters to the other domain. > >> > >> '*********CODE FOR MY DOMAIN (US) ********* > >> Dim objConnection, objCommand > >> Set objConnection = CreateObject ("ADODB.Connection") > >> objConnection.Open "Provider=ADsDSOObject;" > >> > >> Set objCommand = CreateObject ("ADODB.Command") > >> objCommand.ActiveConnection = objConnection > >> objCommand.Properties ("Asynchronous") = True > >> objCommand.Properties ("Cache Results") = True > >> objCommand.Properties ("Page Size") = 10 > >> objCommand.Properties ("Size Limit") = 100 > >> > >> Dim objRecordSet > >> > >> objCommand.CommandText = "<LDAP://dc=us, dc=fabrikam, > >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > >> Server*));name;subtree" > >> > >> Set objRecordSet = objCommand.Execute > >> > >> While Not objRecordSet.EOF > >> WScript.Echo objRecordSet.Fields ("name") & vbCr > >> objRecordSet.MoveNext > >> Wend > >> > >> objConnection.Close > >> > >> '*********CODE FOR DOMAIN THAT DOESN'T WORK (MX)********* > >> Set objConnection = CreateObject ("ADODB.Connection") > >> objConnection.Open "Provider=ADsDSOObject;" > >> > >> Set objCommand = CreateObject ("ADODB.Command") > >> objCommand.ActiveConnection = objConnection > >> objCommand.Properties ("Asynchronous") = True > >> objCommand.Properties ("Cache Results") = True > >> objCommand.Properties ("Page Size") = 10 > >> objCommand.Properties ("Size Limit") = 100 > >> > >> objCommand.CommandText = "<LDAP://dc=mx, dc=fabrikam, > >> dc=com>;(&(objectCategory=computer)(operatingSystem=Windows > >> Server*));name;subtree" > >> > >> Set objRecordSet = objCommand.Execute > >> > >> While Not objRecordSet.EOF > >> WScript.Echo objRecordSet.Fields ("name") & vbCr > >> objRecordSet.MoveNext > >> Wend > >> > >> objConnection.Close > >> > >> '*********END CODE ********* > >> > >> Is this a binding issue to the MX domain? > > > > -- > > -- HAL07, Engineering Services, Norway > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| working LDAP query, well almost.. 800A000D | VB Script | |||
| Query LDAP to get user Telephone | VB Script | |||
| How can I query LDAP in WLM? | Live Mail | |||
| Not all users are retrieved in an LDAP query via ASP | VB Script | |||
| help with LDAP query | PowerShell | |||