Lets say that your Exchange 2013 has multiple domains from various companies over the years:

  • @company1.tld
  • @company2.tld
  • @company3.tld

Some mailboxes have @company1.tld email addresses but not all mailboxes have @company1.tld email addresses.

A decision has been made that everyone without an @company1.tld email address needs to have one. Or you are staging for a domain change or company merger of some type.

How do you find the mailboxes without @company1.tld and then add an @company1.tld email address without changing the current email address?

Here's how:

Get-Mailbox -Filter {EmailAddresses -notlike "*company1.tld"} |ForEach {set-mailbox $_.samaccountname -EmailAddresses @{Add=$_.samaccountname+"@company1.tld"}}

Boom.

(Of course, this is provided that your samaccountname/computer-username is the name that you want to use for your email address. Most of the time it is.)

Check your work:

Get-Mailbox -Filter {EmailAddresses -notlike "*company1.tld"} |select emailaddresses