Email address policy on Office 365
There is always chance of getting the domain change for any of the organization. This change for the domain might be due to the acquisition, merger or due to split. But when we need to change email address of the existing users after change in domain, it is pain. Adding the domain on office 365 and making that appear that on the accepted domain does not work with automatic adding of SMTP address of new domain on the email addresses. And unfortunately, there is no email address policy on office 365. So, on this blog I am trying to work with the script through which we can add the additional SMTP address on existing email addresses and also how to make that newly added domain as the primary email address.
Below script will help you to add the additional domain on your email address, but before running the script you need to and accepted domain and then connect to your exchange online.
$users = Get-Mailbox foreach ($a in $users) {$a.emailaddresses.Add("$($a.alias)@yourdomain")} $users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}
But what if we need to change the required email address to primary SMTP address. Unfortunately the parameter ‘-PrimarySmtpAddress’ is available only in on-premises Exchange on for the Exchange online. But don’t worry we do have way around, you can set primary address by using “SMTP” in uppercase in the email address. For e.g.
Set-Mailbox -identity -EmailAddresses SMTP:youremailaddress
So now the script becomes
$users = Get-Mailbox foreach ($a in $users) {$a.emailaddresses.Add("$($a.alias)@yourdomain")} $users | %{Set-Mailbox $_.Identity -EmailAddresses SMTP:$_.EmailAddresses}
Hope this script will help you to add the email address for the newly added domains.
-GOOD yes it working