We like to remove Let's Encrypt certificate in Windows Server. Before we uninstall Let's Encrypt…
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.
Table of contents
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 allow 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)
Enable setting for a specific mailbox
Before you start, run Exchange Management Shell as administrator.
Check if EmailAddressPolicyEnabled is showing as True or False. The policy option is not enabled for the user mailbox because it’s showing as False. Enable the option with the second cmdlet.
[PS] C:\>Get-Mailbox -Identity "Amanda.Morgan@exoip.com" | ft Name, EmailAddressPolicyEnabled
Name EmailAddressPolicyEnabled
---- -------------------------
Jonathan Fisher False
[PS] C:\>Get-Mailbox -Identity "Amanda.Morgan@exoip.com" | Set-Mailbox -EmailAddressPolicyEnabled $True
Enable setting for mailboxes in an Organizational Unit
Do you need to find the Organizational Unit (OU) in Active Directory? Read how to get Organizational Units with PowerShell. Some mailboxes are showing as False and other mailboxes showing 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. Enable the setting with the second cmdlet.
[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
[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.
With the Get-Content cmdlet, you can read the information that’s in the text file. The second cmdlet will enable the setting for the mailboxes 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
[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, you already have the CSV file exported. Place the NotInherting.csv file in C:\temp.
The first cmdlet will read the CSV file in PowerShell. With the second cmdlet, you can verify which mailboxes don’t have the setting enabled. As of last, enable the setting for the mailboxes in the CSV file.
Read more: Export a list of mailboxes to CSV in Exchange »
[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
[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
[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. After that, run the second cmdlet to enable the setting for all the user mailboxes, resource mailboxes, and shared mailboxes.
[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
[PS] C:\>Get-Mailbox -ResultSize Unlimited | Where-Object {$_.EmailAddressPolicyEnabled -eq $False} | Set-Mailbox -EmailAddressPolicyEnabled $True
There are a lot of 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
In this article, you learned how to enable automatically update email addresses based on the email address policy. Use PowerShell instead of the Exchange Admin Center. With PowerShell, there are enough possibilities to enable this setting, and you can apply it in bulk. Choose the option you want and apply it.
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.
This Post Has 0 Comments