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

Query Domain Trust Relationships

Status
Not open for further replies.

cainecabe

MIS
Aug 5, 2004
45
0
0
US
I am trying to query what domains are trusted by a particular domain. So, i figured to query a dc and ask it what domains it trusts and what direction they are.
i found the below script and it somewhat orks for me if i run it locally on the dc, but errors when run remotely. when done locally i get odd output that doesn't match what i expect to see (according to the KB article).
any ideas how i can get it to wortk remotely with me only having to change the target machine (which will always be a DC) to query?

strComputer = "dc name"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\MicrosoftActiveDirectory")
Set colTrustList = objWMIService.ExecQuery _
("Select * from Microsoft_DomainTrustStatus")
For each objTrust in colTrustList
Wscript.Echo objTrust.TrustedDomain
Wscript.Echo objTrust.TrustDirection
Wscript.Echo objTrust.TrustType
Wscript.Echo objTrust.TrustAttributes
Wscript.Echo objTrust.TrustedDCName
Wscript.Echo objTrust.TrustStatus
Wscript.Echo objTrust.TrustIsOK
Next


thanks very much for any input.


Thanks,
 
or if there is anotyher way that someone knows to accomplish this.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top