Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007
Topic Last Modified: 2007-08-13

This topic explains how to use the Exchange Management Shell to create a new address rewrite entry that rewrites all e-mail messages that are sent from multiple sub-domains on a computer that has the Microsoft Exchange Server 2007 Edge Transport server role installed. You can create the following types of address rewrite entries when you rewrite multiple sub-domains:

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 these procedures, read How to Create a New Address Rewrite Entry.

Caution:
You must prepare your sub-domains before you create an address rewrite entry that rewrites multiple domains. For more information, see Preparing to Rewrite Addresses in Multiple Domains.

The New-AddressRewriteEntry cmdlet includes the TemplateInstance parameter. The TemplateInstance parameter lets you copy the configuration of one address rewrite entry to another address rewrite entry. The properties that are available for copying on address rewrite entries are the OutboundOnly property and the ExceptionList property. For more information about how to use an existing address rewrite entry as a template, see Templates.

Rewriting E-mail Messages from All Sub-Domains

To create an address rewrite entry that rewrites the headers of all e-mail messages for all sub-domains, use the following command syntax:

Copy Code
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <*.internal domain> -ExternalAddress <external domain> -OutboundOnly $True

To use the Exchange Management Shell to create a new address rewrite entry that rewrites all e-mail messages that are sent from multiple sub-domains and the parent domain

  • Run the following command:

    Copy Code
    New-AddressRewriteEntry -Name "Rewrite all contoso.com sub-domains" -InternalAddress *.contoso.com -ExternalAddress contoso.com -OutboundOnly $True 
    

Rewriting E-mail Messages from Specific Sub-Domains in Exchange Server 2007 Service Pack 1 (SP1)

To create an address rewrite entry that rewrites the headers of e-mail messages from specific domains in Exchange 2007 SP1, use the following command syntax:

Copy Code
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <internal domain 1> -ExternalAddress <external domain> -OutboundOnly $True
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <internal domain n> -ExternalAddress <external domain> -OutboundOnly $True

To use the Exchange Management Shell to create a new address rewrite entry that rewrites all e-mail messages that are sent from specific sub-domains in Exchange 2007 SP1

  • Run the following commands:

    Copy Code
    New-AddressRewriteEntry -Name "Rewrite sales.contoso.com to contoso.com" -InternalAddress sales.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    New-AddressRewriteEntry -Name "Rewrite marketing.contoso.com to contoso.com" -InternalAddress marketing.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    New-AddressRewriteEntry -Name "Rewrite research.contoso.com to contoso.com" -InternalAddress research.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    

Rewriting E-mail Messages from Specific Sub-Domains the Release to Manufacturing (RTM) Version of Exchange 2007

To create an address rewrite entry that rewrites the headers of e-mail messages from specific domains in Exchange 2007 RTM, use the following command syntax:

Copy Code
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <*.internal domain 1> -ExternalAddress <external domain> -OutboundOnly $True
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <*.internal domain n> -ExternalAddress <external domain> -OutboundOnly $True

To use the Exchange Management Shell to create a new address rewrite entry that rewrites all e-mail messages that are sent from specific sub-domains in Exchange 2007 RTM

  • Run the following commands:

    Copy Code
    New-AddressRewriteEntry -Name "Rewrite sales.contoso.com to contoso.com" -InternalAddress *.sales.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    New-AddressRewriteEntry -Name "Rewrite marketing.contoso.com to contoso.com" -InternalAddress *.marketing.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    New-AddressRewriteEntry -Name "Rewrite research.contoso.com to contoso.com" -InternalAddress *.research.contoso.com -ExternalAddress contoso.com -OutboundOnly $True
    

Rewriting E-mail Messages from All Sub-Domains with Exceptions

To create an address rewrite entry that rewrites the headers of all e-mail messages for all sub-domains except for specific sub-domains, use the following command syntax:

Copy Code
New-AddressRewriteEntry -Name <address rewrite entry name> -InternalAddress <*.internal domain> -ExternalAddress <external domain> -OutboundOnly $True -ExceptionList <excluded domain name 1, excluded domain name 2>

To use the Exchange Management Shell to create a new address rewrite entry that rewrites all e-mail messages that are sent from multiple sub-domains and the parent domain, except sub-domains that you specify

  • Run the following command:

    Copy Code
    New-AddressRewriteEntry -name "Rewrite all contoso.com sub-domains except legal.contoso.com" -InternalAddress *.contoso.com -ExternalAddress contoso.com -OutboundOnly $True -ExceptionList legal.contoso.com, corp.contoso.com
    

For More Information

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

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