Email addresses are a constantly changing constraint for countless administrations, principally when mergers, acquisitions, or re-branding movements are underway. Unsurprisingly, this is something that falls on the Exchange manager to resolve. There's an assortment of situations that could be put in front of you, depending on whether it is all or just some of the users in the organization that need an email address change.
My organization recently migrated to Office 365 and lost some of the SMTP proxy addresses in the move. We use these addresses with multiple different services to route notifications. In this instance, we are routing our voicemail to email. A mailbox can have multiple different addresses in which it receives mail.
I needed to create a new email alias with the users sAMAccountName property attached to our new domain.
This had to be done in our on-premises Active Directory and then synced to Azure AD.
Using the code shown below, I was able to automate that process.
In order for this to work, you’ll need to have the new domain verified and set up in Office 365.
Here’s how to do it:
foreach (
$user in
(get-aduser -filter 'enabled -eq $true')
)
{$newsmtp = "$($user.samaccountname)@yourdomain.com"
set-aduser $user.samaccountname -Add @{Proxyaddresses="smtp:$newsmtp"} -verbose}
3. You’re done. You can run the following command to confirm that it worked:
get-aduser -filter 'enabled -eq $true' -properties * | Select-object proxyaddressess -ExpandProperty proxyaddresses
This creates a new SMTP proxy address for every active user in the domain. After creating the aliases, Office 365 takes about 24 hours to allow delivery to those addresses.
I hope this article helps you implement a similar solution in your environment.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)