Geeks With Blogs
Michel Klomp Monitoring and Scripting

Here is a small Powershell script for creating a two-way forest trust.

$localforest = [System.DirectoryServices.ActiveDirectory.Forest]::getCurrentForest()
$strRemoteForest = ‘domain.local’
$strRemoteUser = ‘administrator’
$strRemotePassword = ‘P@ssw0rd’
$remoteContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext(‘Forest’, $strRemoteForest,$strRemoteUser,$strRemotePassword)
$remoteForest = [System.DirectoryServices.ActiveDirectory.Forest]::getForest($remoteContext)
$localForest.CreateTrustRelationship($remoteForest,’Bidirectional’)

Posted on Tuesday, March 15, 2011 3:44 AM | Back to top


Comments on this post: Creating a two-way Forest trust with Powershell

# re: Creating a two-way Forest trust with Powershell
Requesting Gravatar...
Yes, I also am looking forward to the demos you promised. I think they are very informative and a lot of information and tips are shared to this kind of knowledge sharing tools. - Marla Ahlgrimm


Left by Marla Ahlgrimm on Feb 20, 2012 12:00 PM

# re: Creating a two-way Forest trust with Powershell
Requesting Gravatar...
Amazing !! worked like a Charm. Thanks
Left by vishal on Dec 20, 2015 10:48 PM

Your comment:
 (will show your gravatar)


Copyright © Michel Klomp | Powered by: GeeksWithBlogs.net