0

I am currently adding a huge list of domains to my external relay in Exchange Server 2010. I know that there is a way to import data from a CSV file but I'm having trouble figuring out how to write it correctly so that the data will get placed how I want it.

The powershell command i'm currently using is as follows:

New-AcceptedDomain -name "Domain.com" -DomainName domain.com -DomainType ExternalRelay

I know that the Import-CSV | command can be used to specify data and designate it for the -name and -DomainName attributes. But I need help.

2 Answers2

0

Ok, just so you are aware of what worked for me. I used the following excel shortcut:

=CONCATENATE(C1,A1,E1,B1,F1)

Where C1 = New-AcceptedDomain -Name "

A1 =  domain.com

E1 =  "-DomainName 

B1 =  domain.com -

F1 =  DomainType ExternalRelay

This took my data from columns a and b and input them into the correct format in Column D.

New-AcceptedDomain -Name "domain.com" -DomainName domain.com -DomainType ExternalRelay

By copying the information in Column D and pasting it directly into powershell it runs each as its own command in the order you place them in. Regardless of how many you have selected at once it will still run them in order 1 at a time after you paste the rows into powershell.

0

I was also able to get it done in powershell with the following:

$Domains = Import-CSV Domains.csv

ForEach($Domain in $Domains)

{ 

New-AcceptedDomain -name $Domain.Name -DomainName $Domain.Domain -DomainType ExternalRelay

}

CSV File need in this format...

name, domain

domain1.com, domain1.com

domain2.com, domain2.com