共用方式為


How to Re-Home Exchange Mailbox Accounts

 

This topic provides an example of how you might use the Lightweight Directory Access Protocol Data Interchange Format directory export tool (LDIFDE) to re-home all mailbox accounts on one server to a different server.

Note

For more information about LDIFDE, see the topic Using LDIFDE to Manipulate Mailbox Attributes.

The following table provides values related to the example. All of these values are in a single unbroken line, although they may appear wrapped on your display.

Values of attributes used in example of re-homing mailbox values

Attribute Value

Active Directory® directory service domain name where all user accounts are located

contoso.com

Source database

DB1

Source storage group

SG1

Source server

Exchange1

Microsoft® Exchange organization

Organization

Destination database

DB2

Destination storage group

SG2

Destination server

Exchange2

LDAP name of the domain

DC=contoso,DC=com

Source server msExchHomeServerName

/o=Organization/ou=AG1/cn=Configuration/cn=Servers/cn=Exchange1

Source server homeMTA

CN=Microsoft MTA,CN=Exchange1,CN=Servers,CN=AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com

Source database homeMDB

CN=DB1,CN=SG1,CN=InformationStore,CN=Exchange1,CN=Servers,CN=AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com

Before You Begin

This example assumes that you are generally familiar with Active Directory object naming and hierarchical organization and with general LDAP object and attribute naming conventions.

Procedure

To re-home mailbox accounts from Exchange1 to Exchange2
  1. Export the user accounts with this LDIFDE command:

    LDIFDE –F [output file] –D [domain and/or container name] –L [attributes to export] –R [LDAP query filter for the database]

    For example:

    LDIFDE –F EXPORT-EXCHANGE1.TXT –D “DC=contoso,DC=com” –L msExchHomeServerName,homeMDB,homeMTA –R “(homeMDB=CN=DB1,CN=SG1,CN=InformationStore,CN=Exchange1,CN=Servers,CN=AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com)”

    This command exports all the user accounts linked to mailboxes in DB1, with each export record appearing similar to this one:

    Note

    In the examples below, several lines are formatted with an attribute name on one line followed by value names that are indented a single space and split into multiple lines. This is the LDIF convention for continuing an attribute value across a line break.

    dn: CN=User1,CN=Users,DC=contoso,DC=com

    changetype: add

    homeMTA:

    CN=Microsoft MTA,CN=Exchange1,CN=Servers,CN=AG1,CN=Administr

     ative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN

     =Configuration,DC=contoso,DC=com

    homeMDB:

     CN=DB1,CN=SG1,CN=InformationStore,CN=Exchange1,CN=Servers,C

     N=AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Ex

     change,CN=Services,CN=Configuration,DC=contoso,DC=com

    msExchHomeServerName:

     /o=Organization/ou=AG1/cn=Configuration/cn=Servers/cn=Exchange1

  2. Reformat each record in the export file so that it can be used to modify each user account. The general format of such an import file is:

    dn: <value>

    changetype: modify

    replace: <attribute name>

    <attribute name>: <value>

    -

    Replace: <attribute name>

    <attribute name>: <value>

    -

    #<blank line>

    #<next record>

    For example:

    dn: CN=User1,CN=Users,DC=contoso,DC=com

    changetype: modify

    replace: homeMTA

    homeMTA:

     CN=Microsoft MTA,CN=Exchange1,CN=Servers,CN=AG1,CN=Administr

     ative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN

     =Configuration,DC=contoso,DC=com

    -

    replace: homeMDB

    homeMDB:

     CN=DB1,CN=SG1,CN=InformationStore,CN=Exchange1,CN=Servers,CN=

     AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange

     ,CN=Services,CN=Configuration,DC=contoso,DC=com

    -

    replace: msExchHomeServerName

    msExchHomeServerName:

     /o=Organization/ou=AG1/cn=Configuration/cn=Servers/cn=Exchange1

    -

    Dn: CN=User2,CN=Users,DC=contoso,DC=com

    changetype: modify

    <and so on……>

    If you have a text editor that can perform a search and replace across line breaks, it is relatively easy to transform the export file into the appropriate import format. For example, you can do this in Microsoft Office® Word, where ^p is the Word search, and replace code for a line break:

     

    Search for Replace with

    dn:

    -^pdn:

    changetype: add

    changetype: modify

    homeMTA

    replace: homeMTA^phomeMTA

    homeMDB

    -^preplace: homeMDB^phomeMDB

    msExchHomeServerName

    -^preplace: msExchHomeServerName

    [name of original database]

    [name of new database]

    [name of original storage group]

    [name of new storage group]

    [name of original server]

    [name of new server]

    After you have finished the replacements, remove the blank line and “-‘ from the top of the file before the first record, and add a “-“ and a blank line to the end of the last record.

    If you are using Microsoft Word or another rich text editor, be sure to save the file as plain text. You should save the file under a new name, such as EXCHANGE2-IMPORT.TXT, so that the original export file is preserved if additional editing is required.

  3. Import the file with this command:

    LDIFDE –I – F <import file>

    For example:

    LDIFDE –I –F EXCHANGE2-IMPORT.TXT

    Important

    Do not re-home mailboxes for SMTP connectors, the System Attendant, or the System Mailbox. Remove the LDIF records for these mailbox types in your import file before you import again. Search for “SMTP”, “SystemMailbox”, and “System Attendant” to locate these mailboxes.

For More Information

For more information about other methods you can use to enable, disable, and re-home mailboxes, see Using Active Directory Attributes to Enable, Disable, and Re-Home Mailboxes.