Trust Relationship: Sample Case I


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.

and Domain2 are trusted domains of the domain where the sample script will run.


  1. Add Domain1 as a trusting domain on Domain2 using a string as the trust password.

  2. Add Domain2 as a trusted domain on Domain1 using the same password that was used in the above step.


Dim Trusting As IDomainTrustManagement
Dim Trusted As IDomainTrustManagement

Dim Password as String

'Get the interface

Set Trusted = GetObject ("NTDS://Domain1")

'Get the interface.

Set Trusting = GetObject ("NTDS://Domain2")

Password = InputBox ("Enter the password used while creating trust relationship", "")

'Add the Domain1 as trusting domain on Domain2

Trusting.AddTrustingDomain "Domain1", Password

'Add the Domain2 as trusted domain on Domain1

Trusted.AddTrustedDomain "Domain2", Password


See Also