- Bart Timmermans aka Hyper-B - http://www.bart-timmermans.nl -

Exchange Powershell: How to import accepted domains from CSV file

Posted By Bart Timmermans On October 5, 2011 @ 11:38 pm In Exchange Server 2007,Exchange Server 2010,Exhange Server,Management,Microsoft,Powershell | No Comments

[1]

During migration [2] projects a lot of customers asks me how to [3] 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 [4] command for creation of all Accepted Domains.

New-AcceptedDomain -Name $AcceptedDomain -DomainName $AcceptedDomain

}


Article printed from Bart Timmermans aka Hyper-B: http://www.bart-timmermans.nl

URL to article: http://www.bart-timmermans.nl/exchange-powershell-how-to-import-accepted-domains-from-csv-file/

URLs in this post:

[1] Image: http://www.bart-timmermans.nl/wp-content/uploads/2010/04/exchange-2010-logo-7333411.png

[2] migration: http://www.bart-timmermans.nl/tag/migration/

[3] how to: http://www.bart-timmermans.nl/tag/how-to/

[4] powershell: http://www.bart-timmermans.nl/powershell/

Copyright © 2009 Bart Timmermans. All rights reserved.