Fixing Mail-Enabled Object Aliases for Exchange Server 2010 Migration

This article is an excerpt from the Exchange Server 2003 to 2010 Migration Guide.

Exchange Server 2010 treats some object attributes differently than Exchange Server 2003.  The most common issue that this causes is invalid aliases on mailbox users, however it can also occur for contacts and groups.

Exchange Server 2010 applies the following rules to aliases:

Valid values are: Strings formed with characters from A to Z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ‘, *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more periods may be embedded in an alias, but each period should be preceded and followed by at least one of the other characters. Unicode characters from U+00A1 to U+00FF are also valid in an alias, but they will be mapped to a best-fit US-ASCII string in the e-mail address, which is generated from such an alias.

You can see which mailboxes have invalid aliases by running the following command from the Exchange Management Shell.

Get-Mailbox -resultsize unlimited | findstr "Warning"

If there are only a few mailbox users with invalid aliases you can correct them manually using Active Directory Users & Computers on an Exchange 2003 server.

Exchange 2003 Mailbox User Alias

Exchange 2003 Mailbox User Alias

However if there are a lot of mailbox users that need aliases fixed you can use a script provided by Microsoft to automatically correct them.  The Fix-Alias.ps1 script is available to download here:

The Fix-Alias.ps1 script has a built in help function to explain how to use it.


[PS] C:\Admin>.\fix-alias.ps1 -help

This script will find objects of the specified type that contain a space in the aliasIt will remove the space from the alias and update the object

Both the search character and the replacement character can be changed using the advanced options

Advanced Options:

-Type       : Used to specifiy the get- command that is run to find the objects (Mailbox,Distributiongroup,Mailcontact)
-Resultsize : Used to specifiy a result size other than the default of "Unlimited"
-Search     : Used to specify the character / sting to search for
-Replace    : Used to specify the replacement character
-Add        : Used to provide the get- command with addtional switch options
-Help       : Display this help message

Examples:

fix-alias.ps1 -type MailContact -Search "@" -Replace "_" -add "-OrganizationalUnit 'My Ou'"

For example, to fix all of the mailbox users in the organization that have spaces in their alias, and replace them with periods, we would run this command:

[PS] C:\Admin>.\fix-alias.ps1 -type Mailbox -search " " -replace "."

The script will then output which objects were found and fixed.

Found Object to Fix: Alannah Shaw
New Alias of Object: Alannah.Shaw

Found Object to Fix: Linda Dowden
New Alias of Object: Linda.Dowden

Found Object to Fix: Olive Weeks
New Alias of Object: Olive.Weeks

Be careful when changing mailbox user aliases. If the Exchange 2003 Recipient Policy uses the alias to generate the user’s email address then a change to the alias may result in a change in primary SMTP address. Check your Recipient Policies first before making changes to aliases using the Fix-Alias.ps1 script.

About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Connect with Paul on Twitter and Google+.

Comments

  1. Hi Paul,

    How do I get an output file of the Get-Mailbox -resultsize unlimited | findstr “Warning”. By default it just pipes it to the screen and in my case there are way too many of them (they scroll off the screen). I cannot find way to put the results in a file which I can then provide to my client and have them fix them either using the script listed here or manually. I have tried using the Out-file parameter but that doesn’t work…well not for me. I’d imagine there has to be a way as a company may have thousands of such accounts.

    I appreciate your time

    Cheers!

    Graeme

    • Hi Graeme, yeah that findstr method is actually not a very good way of doing that, particularly in larger environments.

      There’s probably some scripting that could do the trick, possibly using a try/catch but I don’t have a scenario setup to test it out.

      Perhaps in your case just go through smaller batches by limiting your Get-Mailbox (eg to specific databases one at a time, or filtering by surname).

  2. Raheem Shapi says:

    I know this post is old but thought I would share one way of doing what Graeme asked you could run Start-Transcript -path “C:\Temp\PSOutput.txt -append followed by Get-Mailbox -resultsize unlimited | findstr “Warning”. I am sure there is a better method at catching the errors and filtering but for now this does the job :) . Hope this helps…..

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.
Loading...

Still running Exchange 2003? Time to get moving and start your upgrade. Find out how - Click Here