1

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?

3
  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
  • 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
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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