Export/Import Active Directory Entries To/From a Domain Controller


We can use the ldifde.exe to import and export Active Directory entries to/from a Domain Controller. Ldifde.exe can be found in c:\windows\system32 folder. If you can’t find it then run the add-ons to install that command line tool.

To export the Organizational Units or simply OUs, please execute the following command:

ldifde -f exportOu.ldf -s dcdomnp01 -d "dc=MyDomain,dc=Com" -p subtree -r  "(objectCategory=organizationalUnit)" -l "cn,objectclass,ou"

To export User Accounts please execute the following command:

ldifde -f Exportuser.ldf -s dcdomnp01 -d " dc=MyDomain,dc=Com" -p subtree -r "(&(objectCategory=person) (objectClass=User)(givenname=*))" -l
"cn,givenName,objectclass,samAccountName,company,c,co,employeeNumber,givenName,sn,streetAddress,l, st,postalCode,title,costCenter,department,manager,"

And, to import them into the new domain, please execute the following commands:

ldifde -i -f ExportOU.ldf -s MyToDomain.Com

ldifde -i -f Exportuser.ldf -s MyToDomain.Com

To Add/Remove the AD attributes please change the attribute section on the previously stated commands.

Done….It’s that simple


Comments

Popular posts from this blog

How to Create SSRS Report on SharePoint List

Database Testing With DBUnit

SAP RFC Integration through BizTalk