Applies to: Exchange Server 2010 SP3, Exchange Server 2010 SP2

Topic Last Modified: 2012-07-23

You can use the Shell to remove a single address rewrite entry and multiple address rewrite entries on a computer that has the Edge Transport server role installed.

In Microsoft Exchange Server 2010, you can use the Address Rewriting agent to modify the addresses of senders and recipients on messages that enter and leave an Exchange 2010 organization.

For more information about address rewriting, see Understanding Address Rewriting.

Looking for other management tasks related to transport agents? Check out Managing Transport Agents.

Caution:
Be careful when you remove an address rewrite entry or multiple address rewrite entries. The changes that you make are applied immediately. Make sure that you are removing the correct address rewrite entries and make a note of the configuration of any entry before you delete it. After you decide which address rewrite entries to remove, we recommend that you first run the command with the WhatIf parameter. For more information about the WhatIf parameter, see WhatIf, Confirm, and ValidateOnly Switches.

Use the Shell to remove a single address rewriting entry

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Address Rewriting agent" entry in the Transport Permissions topic.

Note:
You can't use the EMC to remove a single address rewriting entry.

Remove a single address rewrite entry by using the following command syntax.

Copy Code
Remove-AddressRewriteEntry <GUID or address rewrite entry name>

This example runs the Remove-AddressRewriteEntry cmdlet with the WhatIf switch. The WhatIf switch lets the command run as if it were going to perform the action you specified but doesn't commit any changes. Instead, it displays the results of what would have happened, so you can verify that the actions are correct.

Copy Code
Remove-AddressRewriteEntry "Contoso.com to Northwindtraders.com" -WhatIf

This example removes a single address rewriting entry.

Copy Code
Remove-AddressRewriteEntry "Contoso.com to Northwindtraders.com"

For detailed syntax and parameter information, see Remove-AddressRewriteEntry.

Use the Shell to remove multiple address rewriting entries

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the "Address Rewriting agent" entry in the Transport Permissions topic.

Note:
You can't use the EMC to remove multiple address rewriting entries.

To remove multiple address rewrite entries, you must use pipelining to pipe the output of the Get-AddressRewriteEntry command to the Remove-AddressRewriteEntry command. The Get-AddressRewriteEntry command accepts wildcard characters that let you specify matches based on partial names that you supply. The Remove-AddressRewriteEntry command accepts the results from the Get-AddressRewriteEntry command and removes the address rewrite entries that are returned.

For example, assume that you have configured the following address rewrite entries:

  • "Rewrite sales.northwindtraders.com to contoso.com"

  • "Rewrite marketing.northwindtraders.com to contoso.com"

  • "Rewrite research.northwindtraders.com to contoso.com"

  • "Rewrite john@northwindtraders to support@contoso.com"

  • "Rewrite joe@northwindtraders to support@contoso.com"

You can use a wildcard character to match a subset of these address rewrite entries. The following examples show how to use a wildcard character to match specific entries in this list:

  • Match only the subdomain address rewrite entries.

    Copy Code
    Get-AddressRewriteEntry "*to contoso.com"
    
  • Match only the e-mail address rewrite entries.

    Copy Code
    Get-AddressRewriteEntry "*support@contoso.com"
    
    Caution:
    If you don't specify match criteria when you pipe the results of Get-AddressRewriteEntry to Remove-AddressRewriteEntry, all address rewrite entries on the local server will be deleted. Therefore, we recommend that you always use the WhatIf parameter to make sure that the changes that you are making are correct.

For more information about pipelining, see Pipelining.

Remove multiple address rewrite entries by using the following command syntax.

Copy Code
Get-AddressRewriteEntry <match criteria> | Remove-AddressRewriteEntry 

This example runs the Get-AddressRewriteEntry cmdlet with the WhatIf switch. The WhatIf switch lets the command run as if it were going to perform the action you specified but doesn't commit any changes. Instead, it displays the results of what would have happened, so you can verify that the actions are correct.

Copy Code
Get-AddressRewriteEntry "*to contoso.com" | Remove-AddressRewriteEntry -WhatIf

This example removes multiple address rewriting entries.

Copy Code
Get-AddressRewriteEntry "*to contoso.com" | Remove-AddressRewriteEntry

For detailed syntax and parameter information, see Get-AddressRewriteEntry.