Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007
Topic Last Modified: 2006-03-20

This topic explains how to use the Exchange Management 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 Exchange Server 2007, the Address Rewriting agent lets you modify the addresses of senders and recipients on messages that enter and leave an Exchange Server 2007 organization.

Note:
You cannot administer the Address Rewriting agent by using the Exchange Management Console. To administer the Address Rewriting agent, you must use the Exchange Management Shell. For more information about how to use the Exchange Management Shell, see Using the Exchange Management Shell.

For more information about address rewriting, see Planning for Address Rewriting.

Before You Begin

To perform the following procedures on a computer that has the Edge Transport server role installed, you must log on by using an account that is a member of the local Administrators group on that computer.

Also, before you perform this procedure, read How to View an Address Rewrite Entry.

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 have decided 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 Parameters.

Removing a Single Address Rewriting Entry

In the Exchange Management Shell, you can remove a single address rewrite entry by using the following command syntax:

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

To use the Exchange Management Shell to remove a single address rewrite entry

  1. Run the following command to test your changes:

    Copy Code
    Remove-AddressRewriteEntry "Contoso.com to Northwindtraders.com" -WhatIf
    
  2. Run the following command to apply your changes:

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

Removing 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 to specify matches that are based on partial names that you supply. The Remove-AddressRewriteEntry command accepts the results from 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 sub-domain 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 do not 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.

In the Exchange Management Shell, you can remove multiple address rewrite entries by using the following command syntax:

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

To use the Exchange Management Shell to remove multiple address rewrite entries

  1. Run the following command to test your criteria:

    Copy Code
    Get-AddressRewriteEntry "*to contoso.com" | Remove-AddressRewriteEntry -WhatIf
    
  2. Run the following command to apply your changes:

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

For More Information

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

For more information about address rewriting, see the following topics: