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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query another AD forest

Status
Not open for further replies.

sn0rg

IS-IT--Management
Aug 5, 2005
95
0
0
GB
Hi Guys

My Company has joined with another, and we have both got a Win 2003 AD. I want to run a query against their AD via ADO as follows:

Code:
set ons=getobject("LDAP:")

set ocontainer=ons.OpenDSObject( _
	"LDAP://Company2DC.company2.com/cn=users,dc=company2,dc=com", _
	szUsername, _
	szPassword, _
	ADS_SECURE_AUTHENTICATION and ADS_SERVER_BIND)

	ocontainer.filter=array("user")

	for each ouser in ocontainer
		wscript.echo ouser.distinguishedname
	next

This results in an error on line 3 -
(null): An operations error occurred.

I have verified that the account I specify is valid and can execute a query using an LDAP tool.

If I amend the values to run against my own AD, I have no problem.
 
Is this your full code? If not post your entire script.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top