A. Using the Active Directory Services Interface (ADSI) you can use a script like the following sample to query objects from AD--such as trustedDomain objects from a domain's system container--and thereby obtain a list of all the trusted domains.
Option Explicit Dim objConnection, objChild Set objConnection = GetObject("LDAP://vs2003dstdc1.dest.test/cn=system,dc=dest,dc=test") objConnection.Filter = Array("trustedDomain") For Each objChild In objConnection WScript.Echo objChild.Name Next Wscript.Echo "Operation Completed"
Ensure that you replace the "Set objConnection" Lightweight Directory Access Protocol (LDAP) connection string with one for your domain. For example, if a domain controller (DC) is DC1 in domain savilltech.com, the line would read:
Set objConnection = GetObject("LDAP://dc1.savilltech.com/cn=system,dc=savilltech,dc=com")
0 comments
Hide comments