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