Export (0) Print
Expand All

How to Remove Spaces From Recipient Aliases by Using the Exchange Management Shell

 

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:

  • When you try to view the properties of a recipient with spaces in its alias using the Exchange Management Console, you will receive the following error:

    The properties on <recipient name> have invalid data. If you click OK, default values will be used instead and will be saved if you do not change them before hitting Apply or OK on the property page. If you click cancel, the object will be displayed read-only and corrupted values will be retained. The following values have invalid data: Alias.

  • When you access a recipient with spaces in its alias using the Get- cmdlet in the Exchange Management Shell, you will receive the following warning:

    WARNING: Object <distinguished name of the recipient> has been corrupted and it is in an inconsistent state. The following validation errors have been encountered:

    WARNING: <alias of the recipient> is not valid for Alias.

  • When you try to update the properties of a recipient with spaces in its alias using the Set- cmdlet in the Exchange Management Shell, you will receive the following error:

    Set-<recipient type> : <alias of the recipient> is not valid for Alias.

  • You will not be able to move a mailbox with spaces in its alias to an Exchange 2007 server.

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.

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.

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

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

    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.

noteNote:
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.

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

For more information about managing recipients, see Managing Recipients.

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft