Topic Last Modified: 2007-09-24

This topic explains how to use the Exchange Management Shell to remove spaces from recipient aliases. In Microsoft Exchange Server 2003, you can create recipients with spaces in aliases. Exchange Server 2007 does not allow recipients to have spaces in their aliases. 

When you try to manage a recipient with spaces in its alias using the Exchange 2007 management tools, you will experience the following issues:


If you have a mixed-mode environment with both Exchange 2003 and Exchange 2007 servers, you should remove the spaces from the aliases of your recipients.

Before You Begin

To perform this procedure, the account you use must be delegated the following:

  • Exchange Recipient Administrator role

For more information about permissions, delegating roles, and the rights that are required to administer Exchange 2007, see Permission Considerations.


To use the Exchange Management Shell to remove the spaces from the aliases of your mailboxes

  • Run the following commands to remove the spaces from the aliases of your mailboxes. The first command locates all the mailboxes in your organization that have spaces in their aliases and stores them in the temporary variable $Mailboxes. The second command removes the spaces from the aliases of all the mailboxes stored in the temporary variable $Mailboxes.

    Copy Code
    $Mailboxes = Get-Mailbox | Where {$_.Alias -like "* *"}
    ForEach($Mailbox in $Mailboxes) {Set-Mailbox $Mailbox.Name -Alias:($Mailbox.Alias -Replace " ","")}
  • As an alternative, you can combine the two preceding commands into a single Exchange Management Shell command.

    Copy Code
    Get-Mailbox | Where {$_.Alias -like "* *"} | ForEach-Object {Set-Mailbox $_.Name -Alias:($_.Alias -Replace " ","")}

For detailed syntax and parameter information, see the Get-Mailbox and the Set-Mailbox reference topics.

The preceding procedure shows how to remove spaces from the aliases of your mailboxes. The procedure is the same for mail contacts, mail users, and distribution groups. You only need to substitute the Get-Mailbox and Set-Mailbox cmdlets with the corresponding Get- and Set- cmdlets for each recipient type.

For More Information

To learn more about recipients in Exchange 2007, see Understanding Recipients.

For more information about managing recipients, see Managing Recipients.