Skip to content

Automatically update email addresses based on email address policy

In a previous article, you learned how to list users not inheriting email address policy. Now that you have the information, you like to enable that setting. There are a couple of ways to do that. By default, this setting is checked. In this article, you will learn how to enable automatically update email addresses based on the email address policy.

Enable automatically update email addresses based on email address policy

Before you enable the setting in Exchange Admin Center for the user, it’s good to know which options there are. For example, you can enable it for:

  • A specific mailbox
  • Mailboxes in an Organizational Unit
  • Mailboxes in a text file
  • Mailboxes in a CSV file
  • All mailboxes (user mailboxes, resource mailboxes, and shared mailboxes)
Automatically update email addresses based on email address policy option

Enable setting for a specific mailbox

Before you start, run Exchange Management Shell as administrator.

Run the Get-Mailbox cmdlet and check if the object EmailAddressPolicyEnabled shows the True or False value for the specific mailbox.

The policy option is not enabled for the user mailbox because it’s showing as False.

[PS] C:\>Get-Mailbox -Identity "Amanda.Morgan@exoip.com" | ft Name, EmailAddressPolicyEnabled

Name          EmailAddressPolicyEnabled
----          -------------------------
Amanda Morgan                     False

Enable the email address policy option for the specific mailbox.

[PS] C:\>Get-Mailbox -Identity "Amanda.Morgan@exoip.com" | Set-Mailbox -EmailAddressPolicyEnabled $True

Enable setting for mailboxes in an Organizational Unit

Run the Get-Mailbox cmdlet and check if the object EmailAddressPolicyEnabled shows the True or False value for the mailboxes in an Organizational Unit.

Some mailboxes have the value False, and other mailboxes show the value as True.

[PS] C:\>Get-Mailbox -OrganizationalUnit "exoip.local/Company/Users/IT" | ft Name, EmailAddressPolicyEnabled

Name           EmailAddressPolicyEnabled
----           -------------------------
Jake Cornish                       False
Julian Walsh                        True
James Paterson                     False
Piers Rees                         False
Jeff Allan                          True

List only the mailboxes that don’t have the setting enabled in the Organizational Unit.

[PS] C:\>Get-Mailbox -OrganizationalUnit "exoip.local/Company/Users/IT" | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | ft Name, EmailAddressPolicyEnabled

Name           EmailAddressPolicyEnabled
----           -------------------------
Jake Cornish                       False
James Paterson                     False
Piers Rees                         False

Enable the email address policy setting for the mailboxes in the Organizational Unit that doesn’t have the setting enabled.

[PS] C:\>Get-Mailbox -OrganizationalUnit "exoip.local/Company/Users/IT" | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | Set-Mailbox -EmailAddressPolicyEnabled $True

Enable setting for mailboxes in a text file

Create a text file with the name users.txt in C:\temp. Put the names of the mailboxes or the email addresses in the text file. Read more on how to export a list of mailboxes to text file.

Automatically update email addresses based on email address policy text file

With the Get-Content cmdlet, you can read the information in the text file.

[PS] C:\>Get-Content "C:\temp\users.txt" | Get-Mailbox | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | ft Name, EmailAddressPolicyEnabled

Name          EmailAddressPolicyEnabled
----          -------------------------
Amanda Morgan                     False
Benetiz Anees                     False

Enable the email address policy setting for the mailboxes in the text file that don’t have the setting enabled.

[PS] C:\>Get-Content "C:\temp\users.txt" | Get-Mailbox | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | Set-Mailbox -EmailAddressPolicyEnabled $True

Enable setting for mailboxes in a CSV file

If you followed the article List users not inheriting email address policy, you already have the CSV file exported. Place the NotInherting.csv file in C:\temp.

Automatically update email addresses based on email address policy csv file

Read more: Export a list of mailboxes to CSV in Exchange »

Read the CSV file in PowerShell.

[PS] C:\>Import-Csv "C:\temp\NotInheriting.csv"

Name           PrimarySmtpAddress       SamAccountName EmailAddressPolicyEnabled
----           ------------------       -------------- -------------------------
Larson Tevin   Larson.Tevin@exoip.com   Larson.Tevin   False
Virgina Duncan Virgina.Duncan@exoip.com virgina.duncan False
Madeleine Ross Madeleine.Ross@exoip.com madeleine.ross False

Verify which mailboxes don’t have the setting email address policy setting enabled.

[PS] C:\>Import-Csv "C:\temp\NotInheriting.csv" | foreach {Get-Mailbox -Identity $_.Name | Where-Object {$_.EmailAddressPolicyEnabled -eq $False}} | ft Name, EmailAddressPolicyEnabled

Name           EmailAddressPolicyEnabled
----           -------------------------
Larson Tevin                       False
Virgina Duncan                     False
Madeleine Ross                     False

Enable the setting for the mailboxes in the CSV file.

[PS] C:\>Import-Csv "C:\temp\NotInheriting.csv" | foreach {Get-Mailbox -Identity $_.Name | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | Set-Mailbox -EmailAddressPolicyEnabled $True}

Enable setting for all mailboxes

Get all the mailboxes in the Exchange organization.

[PS] C:\>Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | ft Name, EmailaddressPolicyEnabled

Name           EmailAddressPolicyEnabled
----           -------------------------
Sarah Lee                          False
Kyle Peake                         False
Madeleine Ross                     False
Shared Sales                       False
Room Tokyo                         False

Enable the setting for all the user mailboxes, resource mailboxes, and shared mailboxes.

[PS] C:\>Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | Set-Mailbox -EmailAddressPolicyEnabled $True

There are many options to enable automatically update email addresses based on the email address policy. Which one did you use?

Keep on reading: List all SMTP addresses with PowerShell »

Conclusion

You learned how to enable automatically update email addresses based on the email address policy. It’s faster to use PowerShell instead of Exchange Admin Center. With PowerShell, there are enough possibilities to enable this setting, and you can apply it in bulk.

Did you enjoy this article? You may also like Create bulk mailboxes in Exchange Server with PowerShell. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has One Comment

  1. Ali, your articles are best, I wish you were writing directly for Microsoft. I do have a question on email address updates. We have a default company wide policy and then a second policy of higher rating for a subset of users to get a different domain. If a user already has the default applied and their criteria changes that the higher policy should take affect it doesnt automatically. If I uncheck the automatically apply on the user and save and the recheck and save again the second policy is applied. I would think it should auto apply on its own.
    Pat

Leave a Reply

Your email address will not be published. Required fields are marked *