Home > Exchange Server 2007, Exchange Server 2010, Exhange Server, Management, Microsoft, Powershell > Exchange Powershell: How to import accepted domains from CSV file

Exchange Powershell: How to import accepted domains from CSV file

During migration projects a lot of customers asks me how to import all accepted domains the easy way. The script I provide below is very basic but it will save you a lot of time.

But first create a CSV file with on the first line AcceptedDomains. Insert all your accepted domains on seperate lines starting from the second line.

$File = Read-Host "Please enter location and filename of the CSV file (example: D:TempAcceptedDomain.CSV)"

# Reading of all lines within the specified CSV file.

$list = Import-Csv $File

foreach($entry in $list) {

# Reading the AcceptedDomain variable from the CSV file.

$AcceptedDomain = $entry.AcceptedDomain

# Running the powershell command for creation of all Accepted Domains.

New-AcceptedDomain -Name $AcceptedDomain -DomainName $AcceptedDomain

}

  1. No comments yet.
  1. No trackbacks yet.
Security Code: