Board index » Visual Studio » Access LDAP across domain.

Access LDAP across domain.

Visual Studio275
I am trying to access ldap server across domain to query and then

hopefully configure a computer security context. i.e.

- the script is run from ComputerA (domain - domainXX)

- and query ComputerB (domain - mydomain) for an security context.



When I run the following script, I get 'A referral was returned from

the server'

But, if I run it from a machine from mydomain.lh.int, it works fine.



---

strRemoteMachine = ComputerB

const ADS_SECURE_AUTHENTICATION = 1

strUserName = "myuser"

strPassword = "mypasswd"



buildStr = "LDAP://cn=" & strRemoteMachine&

",cn=Computers,dc=mydomain,dc=lh,dc=int"



Set dso = GetObject("LDAP:")

Set obj1 = dso.OpenDSObject( buildStr, strUserName, strPassword,

ADS_SECURE_AUTHENTICATION)



obj1.GetInfo

intUAC = obj1.Get("userAccountControl")

Wscript.Echo "User Account Control - Before: " & intUAC

---



Any help is appreciated.

Thanks,

Sandiyan.


-
 

Re:Access LDAP across domain.

For anyone scratching their head on 'A referral was returned from the

server' message, it could be to do with 'not using server specific'

binding. In my code I was using serverless binding.

Its been corrected and it all works like a charm now.

e.g.

buildStr = "LDAP://server1.Microsoft.com//cn=" & strRemoteMachine&_

",cn=Computers,dc=mydomain,dc=lh,dc=int"



regards,

Sandiyan.



sandiyan@yahoo.co.uk (sandiyan) wrote in message news:<69e9c64b.0409010823.604e5987@posting.google.com>...

Quote
I am trying to access ldap server across domain to query and then

hopefully configure a computer security context. i.e.

- the script is run from ComputerA (domain - domainXX)

- and query ComputerB (domain - mydomain) for an security context.



When I run the following script, I get 'A referral was returned from

the server'

But, if I run it from a machine from mydomain.lh.int, it works fine.



---

strRemoteMachine = ComputerB

const ADS_SECURE_AUTHENTICATION = 1

strUserName = "myuser"

strPassword = "mypasswd"



buildStr = "LDAP://cn=" & strRemoteMachine&

",cn=Computers,dc=mydomain,dc=lh,dc=int"



Set dso = GetObject("LDAP:")

Set obj1 = dso.OpenDSObject( buildStr, strUserName, strPassword,

ADS_SECURE_AUTHENTICATION)



obj1.GetInfo

intUAC = obj1.Get("userAccountControl")

Wscript.Echo "User Account Control - Before: " & intUAC

---



Any help is appreciated.

Thanks,

Sandiyan.

-