'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4
Dim user, passwd, server, system_cont, ldapObj, trustsObj, trustObj
Dim count, trustTypes, trustDirections
server = "dc1"
user = "administrator@xyz.com"
passwd = "password"
system_cont = "cn=system,dc=xyz,dc=com"
trustTypes = Array("Unknown","Downlevel","Uplevel","Kerberos","DCE")
trustDirections = Array("Disabled","Trusting","Trusted","Trusting and Trusted")
Set ldapObj = GetObject("LDAP:")
Set trustsObj = ldapObj.OpenDsObject("LDAP://" & server & "/" & system_cont, _
user, passwd, 1)
trustsObj.Filter = Array("trustedDomain")
Wscript.Echo "Trusts for " & server & ":"
count = 0
On Error Resume Next
For Each trustObj in trustsObj
count = count + 1
Wscript.Echo count & ". " & trustObj.trustPartner _
& " - " & trustTypes(trustObj.trusttype) _
& " " & trustDirections(trustObj.trustdirection)
Next
|