Ldifde is wonderfull
Last week me and my collegues worked on a big migration project. The problem we faced was that users had multiple smtp adresses. And we hat to migrate them to a new exisitng domain.
We build a couple of scripts with LDIFDE to import those smtp adresses into the Active Directory and that worked like a charm.
Ldifde -d “DC=domain,DC=com” -s DC_Name -r “(&(mailnickname=*))” -l proxyAddresses -f proxies.txt
The query above will generate the following output to proxies.txt
—– Begin File: proxies.txt—–
dn: CN=Test\, User,OU=Users,DC=lab,DC=microsoft,DC=com
changetype: add
proxyAddresses: X400:c=US;a= ;p=Microsoft;o=Lab;s=User;g=Test;
proxyAddresses: SMTP:Test_User@microsoft.com
—– End File—–
Additional attributes besides proxy addresses should be added next to “-l” (comma seperated).
Reimporting will require the manipulation of the output file as follows:
—– Begin File: proxies.txt —–
dn: CN=Test User,OU=Users,OU=Test,OU=Testing,DC=Domain,DC=com
changetype: modify < —- change from add to modify
replace: proxyAddresses <—- This was added
proxyAddresses: SMTP:Test User@AD.com
proxyAddresses: X500:/O=Domain/OU=Test/cn=Recipients/cn=test0000
proxyAddresses: X400:c=US;a= ;p=Testlab;o=Lab;s=User;g=Test;
- <—This is critical and the log file will tell you
—– End File —–
Finally, we’ll import the file by doing the following:
c:\ldifde -i -f proxies.txt -s my_dc -j c:-i means import, -j c:\ is the path to log file
