Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to create a new mailing list in Exchange 2010 which would consist of about 50 external email addresses. I have the list of (external) email addresses in plain text format.

I have previously solved this task by manually creating an external contact for each email address and then adding those external contacts to a distribution group.

What would be the most efficient way to solve this task with Exchange 2010? Does EMS help here?

share|improve this question

2 Answers 2

  1. Make a CSV, c:\distro.csv with 1 column called "PrimarySmtpAddress"
  2. Make a distribution group called DistroGroup
  3. Add the contacts to the group with this code

PowerShell Code:

import-csv c:\distro.csv | foreach {
    $contact = New-MailContact -Name $_.PrimarySmtpAddress -ExternalEmailAddress $_.PrimarySmtpAddress -OrganizationalUnit "Vendors" 
    Add-DistributionGroupMember -id DistroGroup -member $contact
}

c:\distro.csv:

PrimarySmtpAddress
jim@bob.com
joe@user.com
foo@bar.com
share|improve this answer
    
A positional parameter cannot be found that accepts argument 'email@address.com'. + CategoryInfo : InvalidArgument: (:) [Add-DistributionGroupMember], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Add-DistributionGroupMember –  Henno Sep 30 '11 at 6:51
    
Need to apply SP1 first? –  Henno Sep 30 '11 at 6:54
    
Sorry my code was bad. Edited code should work now. I forgot that you need to add the email address as a contact with New-MailContact first and then pass that variable to Add-DistributionGroupMember as shown in the code example. –  phiz Oct 1 '11 at 8:12

You'll still be doing the same thing, but it's definitely a task that's made easier with a little powershell.

You can use New-MailContact to batch-create the mail-enabled contact object, then pass a list of those new objects to New-DistributionGroup as -members.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.