Trust Relationship: Sample Case IV

Given two domains - Domain1 and Domain2, you want to create a trust relationship between Domain1 and Domain2, that is, you want to add Domain2 as a trusted domain of Domain1.

is either the domain where the sample script will run or is a trusted domain of the current domain.

Use the AddTrustedDomain method of IDomainTrustManagement interface to add Domain2 as the trusted domain on Domain1.


Dim Trust As IDomainTrustManagement
Dim Password As String
'Get the interface.
Set Trust = GetObject ("NTDS://Domain1")
Password = InputBox ("Enter the password used while adding trusted domain", "")
'Add domain2 as trusted domain of Domain1
Trust.AddTrustedDomain "Domain2", Password



See Also