<

Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

Appending to a list of proxyAddresses in Exchange Management Shell

Published on
5,264 Points
2,264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
0 Comments

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Join & Write a Comment

To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Other articles by this author
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month