<

Go Premium for a chance to win a PS4. Enter to Win

x

Appending to a list of proxyAddresses in Exchange Management Shell

Published on
5,408 Points
2,408 Views
Last Modified:
Jason Crawford
I am a battle-hardened IT professional with a focus on Windows Server, Active Directory, Exchange, Office 365, and PowerShell.
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!
0
Comment
0 Comments

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Join & Write a Comment

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 antispam), the admini…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month