[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Appending to a list of proxyAddresses in Exchange Management Shell

Published on
5,711 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

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Join & Write a Comment

Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month