Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Remote LDAP

Status
Not open for further replies.

greg0303

Technical User
May 5, 2006
94
CA
Is it possiable to connect to a LDAP directory of a remote domain on the same network? I am domain XYZ, there is a domain ABC which I am not apart of but I can remote desktop to, how can I write a connection string to connect?
 
same way would write one for the domain you are a member, i.e. there should be no difference in the syntax on the contents of the query string will change to reflect the domain in question...

i know its strictly not LDAP (well in some respects) but do you see the domain you are interested in in this list??

Set NameSpace = GetObject("WinNT:")
For Each aDomain In Namespace
Wscript.Echo aDomain.Name
Next
Set NameSpace = Nothing

if you can see then you shouldnt have any issues connecting to it....other than you will need to run the script as a user which has rights to the other domain (if there are those sorts of trust issues or whatever) or you will need to include connecting with alternative creditials in your LDAP moniker string.... dont ask me how to do it with the WinNT provider as i dont think i know how to...
 
'exampleof LDAP query with alt cred 'The Don'

Set DSO = GetObject("LDAP:")
Set Container = DSO.OpenDSObject("LDAP://ldap_server_nameip/o=mydomain.com,ou=People", cn="The Don", "password123", 0)
For Each aObject In Container
Wscript.Echo aObject.Get("cn")
Next
 
No I can not see the domain but I can ping the server.
I tried the connection string you suggested but using the ip address instead of the server name. You have "password123" in the connection, is this for a user account on the domain I am connection to, should there not also be the username?
I get the following error with this connection:
"The server is not operational
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top