Add an Email Address Template to all Email Address Policies

So your company just bought another company.  Or you're moving to Exchange Online. Or you registered a new domain.  Any reason, really, that you could want an email address template added to all of your Email Address Policies.

Not so bad if you have one or two policies  But what if you have 10?  Or 50?  Or 200?  We have some enterprise customers that have even more.  What if you want to just apply it to some of them?  Got you covered.

*channels Samuel L. Jackson*

When you absolutely, positively, got to stamp every EAP in the org--accept no substitutes.

Download the full script at the end of the post or head over to the TechNet Gallery.

To use:

  1. Launch the Exchange Management Shell, then run this script.
  2. Enter the domain for which you wish to configure a template.  The script will verify that it's an accepted domain
  3. Specify the template format.  The default is %m (alias), but you can use any of the normal template replacement strings (see https://support.microsoft.com/en-us/kb/822447for some ideas).
    1. %m - Alias
    2. %s - Surname (last name)
    3. %g - Given Name (first name)
    4. %I - Middle Initial
    5. %d - Display Name
  4. Choose whether you want to apply the template to all email address policies or selectively.
    1. If you choose "yes," it will be added to all that don't have an existing template that matches the format you entered.
    2. If you choose "no," you will be prompted to add the template to each policy.

Note:  These changes will only affect new objects.  If you want to apply the updated policies to all users, run Get-EmailAddressPolicy | Update-EmailAddresPolicy.

https://gallery.technet.microsoft.com/Bulk-or-Selectively-Update-be06b784/file/143749/1/UpdateEAPsSelectively.ps1