Last week we had to migrate almost 200 mailboxes from one domain to another. Since there was no trust between the 2 domains, we handled both the exporting and importing operations separately. The source Exchange server was 2003 and the destination server was Exchange 2007. Exmerge was intuitive option for export the mailboxes to PST files but it has 2 limitations:
1- It can't export a mailbox larger than 2 GB which wasn't an issue for us.
2- It can't handle Unicode so we had to isolate 10 mailboxes of users in China and export their mailboxes using Outlook.
The user list sent by the project coordinator is a flat file with the display names one in each line. We named this file "userlist.txt". I wrote this simple script to generate the LegacyExchangeDN attribute of the users which is the format required for Exmerge.
strUserFile = "userlist.txt"
logFile = "MAILBOXES.txt"
set objFSO = CreateObject("Scripting.FileSystemObject")
strData = objFSO.OpenTextFile(strUserFile, 1).ReadAll
set strLog = objFSO.OpenTextFile(logFile, 2)
arrLines = Split(strData, vbCrLf)
set rootDSE=GetObject("LDAP://RootDSE")
DomainContainer=rootDSE.Get("DefaultNamingContext")
wscript.echo "strdata" & strdata
set adocommand = CreateObject("ADODB.Command")
set conn = CreateObject("ADODB.Connection")
conn.provider = "ADSDSOObject"
conn.Open "Active Directory Provider"
set adocommand.activeconnection = conn
For each strLine in arrLines
adocommand.commandtext= "<LDAP://domain.net>;(&(ObjectClass=user)(displayname=" & strLine & "));adspath;subtree"
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
set rs = adocommand.execute
set userObj = getobject(rs.fields(0).value)
strlog.writeline userObj.legacyexchangedn
set userObj = Nothing
rs.Close
Next
strLog.Close
conn.close
set objFSO = Nothing
Once "MAILBOXES.txt" file is ready, copy it to the folder where Exmerge exists and run exmerge from the command line:
Exmerge -f c:\exmerge\exmerge.ini -B -D
-B to run Exmerge in batch mode
-D to display the progress of the export operation.
I find the best way to prepare exmerge.ini file is to run exmerge from the command line with no parameters which will start the step by step wizard.
Exmerge is a powerful tool which underwent long development and bug fixing from Microsoft and mostly it gets the job done. I'll prepare another post for the import process.
No comments:
Post a Comment