Appending to a list of proxyAddresses in Exchange Management Shell

Published on
5,614 Points
Last Modified:
Jason Crawford
Utilizing an array to gracefully append to a list of EmailAddresses
Adding to a list of EmailAddresses in Exchange has the potential to be one of those 'gotcha' issues that, if performed incorrectly, can really make you momentarily rethink your career in IT.  This is because if proper measures are not taken, the list of mailbox alias' can be overwritten by your one addition.  For example, if the following command was run, all pre-existing proxyAddresses would be overwritten with the addition of userA1@domain.com:
Set-Mailbox userA -EmailAddresses 'userA1@domain.com'

Open in new window

The process to work around this has traditionally involved adding the complete list of alias' each time instead of just the one like so:
$user = Get-Mailbox userA
$user.EmailAddresses += 'userA1@domain.com'
$user | Set-Mailbox

Open in new window

A simple work around available in PowerShell 2.0 and beyond involves the use of an array:
Set-Mailbox userA -EmailAddresses @{add='userA1@domain.com'}

Open in new window

Now we can add just one address at a time instead of being forced to account for the entire list with each new request.  Enjoy!

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

Join & Write a Comment

This video discusses moving either the default database or any database to a new volume.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month