Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi

List Domain Information for Trust Partners in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

List Domain Information for Trust Partners in Windows using VBScript, WMI and LDAP

Example(s)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & _
        strComputer & "\root\MicrosoftActiveDirectory")

Set colDomainInfo = objWMIService.ExecQuery _
    ("Select * from Microsoft_LocalDomainInfo")

For each objDomain in colDomainInfo
    Wscript.Echo "DNS name: " & objDomain.DNSName
    Wscript.Echo "Flat name: " & objDomain.FlatName
    Wscript.Echo "SID: " & objDomain.SID
    Wscript.Echo "Tree name: " & objDomain.TreeName
    Wscript.Echo "Domain controller name: " & objDomain.DCName
Next