Microsoft

Blog Categories

Subscribe to RSS feed

Archives

Create Remote Domains

One of my clients running Exchange 2003 was using over 400 email domains and was trying to setup coexistence with Office 365. One of the requirements for this is to create remote domains both on-premises and in office 365 for each primary SMTP domain and currently there is not a way to automate this (Exchange 2010 SP2 due to be released shortly will do this automatically). Until then here is a small script to automate this process on premises.

$file=“c:scriptstranscript.txt”

If (Test-Path $file)

{

Remove-Item -Path $file -Confirm:$false -Force:$true

}

Add-Content -Path $file -Value (“Domain&name”)

Import-CSV “c:scriptsdomains_list.csv” | foreach{

Write-Host “Adding remote domain” $_.Name

$adddom = “Outbound Remote Domain” + $_.name

New-RemoteDomain -Name $adddom -DomainName $_.name

Write-Host “Setting properties of remote domain” $adddom

Set-RemoteDomain $adddom -TrustedMailOutboundEnabled $true -TargetDeliveryDomain $true -AllowedOOFType internallegacy -AutoReplyEnabled $true -AutoForwardEnabled $true -DeliveryReportEnabled $true -NDREnabled $true -DisplaySenderName $true -TNEFEnabled $true

Add-Content -Path $file -Value ($_.name + “&” + $adddom)

}

Tags: ,

Leave a Reply