Add multiple e-mail adresses to a mail contact with Powershell

In Exchange 2007, mail contacts can have multiple e-mail addresses assigned. You can add these e-mail addresses with the Exchange Management Console. However, if you have to add multiple e-mail addresses or edit multiple mail contacts, it’s often faster to do this with Powershell.

Here’s an example with comments on how to add multiple e-mail addresses to a mail contact. In this example, I’m going to append 3 smtp e-mail addresses to a mail contact named “PeterPetrelli”

C:\> $contact = Get-MailContact -identity PeterPetrelli
The variable $contact is now set to PeterPetrelli. From this point, you can assign values to PeterPetrelli by using $

C:\> $contact.EmailAddresses += “”,””,””

By using +=, you append the e-mail addresses to the mail contact. All existing e-mail addresses are not replaced
If you want the e-mail addresses to be replaced, you should use = instead of +=

C:\> $contact | Set-MailContact
With this Set-MailContact, you apply adding the e-mail addresses.

Now you know how to append e-mail addresses to a mail contact, you can also remove e-mail addresses from a mail contact. Use -=

Leave a Reply

Your email address will not be published.