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 the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Reda BOUTBICHA

    Fix-alias.PS1 script not Found !

  2. Victor Bassey

    You are my Hero too!

  3. Kim Kovacs

    Paul, you’re my hero. As we get ready to move to Office 365 both your technical articles and your book have been absolutely invaluable. Thank you so much for all you do for us struggling Exchange administrators!

  4. hari

    PF migration failed @10%.

    Error:Fatal error DataValidationException has occurred.

  5. Dave

    So what would you do in this situation? I’m getting a lot of these errors for PFs that have been recovered in the past:

    Found Object to Fix: XXX (229/829) (Recovered)
    New Alias of Object: XXX_(229/829)_(Recovered)

    The term ‘Recovered’ is not recognized as the name of a cmdlet, function, scrip
    t file, or operable program. Check the spelling of the name, or if a path was i
    ncluded, verify that the path is correct and try again.
    At line:1 char:117
    + set-MailPublicFolder ‘neirelocation.com/Microsoft Exchange System Objects/XXX
    (829)’ -alias XXX_(229/829)_(Recovered <<<< )
    + CategoryInfo : ObjectNotFound: (Recovered:String) [], CommandNo
    tFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  6. Dave

    Thanks Paul. Quick question, I forgot to restart the Information Store after I created a new database where my public folder mailboxes will reside. Should I now wait until the public folder migration completes before restarting the IS service?

    1. Avatar photo
      Paul Cunningham

      It should be fine either way. The restart is mostly to allow memory allocation between all available databases. If you restart it now the move should resume afterwards.

  7. Wes

    Hey, I’m having the same issue with exchange 2010 public folder.
    when ever i tried to migrate them, I get this error.

    “Message : Error: Property expression “CB News” isn’t valid. 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.”

    Any idea on how can I update the alias on the public folder to remove special characters and spaces?

    1. Avatar photo
      Paul Cunningham

      A few comments above yours there is one about fixing PF aliases.

  8. CJ

    I have an environment that does not connect to the Internet and is not allowed to have files transferred to it from other networks, so I thought I’d share how I got the alias thing fixed for us. In our case, the primary issue was Distribution Groups:

    $dg = Get-DistributionGroup -ResultSize unlimited | select name,alias

    $dg | %{$_.alias = $_.alias -Replace “(|)”,””}

    ^^^ For us, the issue was parenthesis characters, so this is the RegEx I used to match against. We just replaced them all with empty strings.

    $dg | %{Set-DistributionGroup $_.name -Alias $_.alias}

    For whatever reason, trying to pipe this along into one command did not work. I suspect it was because of the warning that gets triggered after the Get command. Pulling the results into a variable allowed me to work with the data without the warnings.

  9. Réda BOUTBCHA

    Hi Paul,

    Try to see this link: http://www.johanveldhuis.nl/tools/scripts/fix-aliasv20.ps1

    a script that can fix incorrect Public Folder aliases, With this version it’s possible to search for multiple incorrect characters and replace them. Besides this chage it is possible to fix incorrect Public Folder aliases.

    1. Andrew

      @Réda BOUTBCHA

      Mate that’s JUST what I was looking for – thank you!!

      1. Luke

        Ditto! LIFE SAVER!

  10. Raheem Shapi

    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:TempPSOutput.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…..

  11. Graeme

    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

    1. Avatar photo
      Paul Cunningham

      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).

Leave a Reply