Link to home
Start Free TrialLog in
Avatar of bbcac
bbcac

asked on

Change vbscript to ldap query across two domains instead of just one

I have a script that I use to query for servers on our domain. I need this same script to get servers from my domain (dom1) as well as another domain (dom2). I've attached the LDAP query section, but I have little LDAP experience and am not sure how to ammend the code to make it work with both domains.




Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.CommandText = "SELECT name, operatingSystem " &_
	"FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") &_
	"' WHERE objectClass='computer' AND (operatingSystem='Windows Server 2003*' OR operatingSystem='*2000 Server*')"
Set objRootDSE = Nothing

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jared Luker
Jared Luker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bbcac
bbcac

ASKER

Thats Great.... works like a charm