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?

2 Answers 2

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
[email protected]
[email protected]
[email protected]
3
  • A positional parameter cannot be found that accepts argument '[email protected]'. + CategoryInfo : InvalidArgument: (:) [Add-DistributionGroupMember], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Add-DistributionGroupMember
    – Henno
    Sep 30, 2011 at 6:51
  • Need to apply SP1 first?
    – Henno
    Sep 30, 2011 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, 2011 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .