Link to home
Start Free TrialLog in
Avatar of slackerUH
slackerUHFlag for United States of America

asked on

Exporting Active Directory Users and then reimporting them after a complete domain rebuild

Is there an easy way to export user accounts and/or OU's from Active Directory and then reimport them after a domain rebuild?  I don't want to retype everybodies name over because there are enough other issues I need to deal with when I do this rebuild.
ASKER CERTIFIED SOLUTION
Avatar of ryansoto
ryansoto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or use csvde to export the users along with the required attributes. Use the below command to export the users in the mentioned OU and all the OUs below it. This command contains all the required attributes.

csvde -j c:\ -m -f c:\users.csv -v -s  -d "OU=ROOT OU,DC=MyDomain,DC=local" -r "(objectClass=user)" -p Subtree -l userPrincipalName,sAMAccountName,DN,givenName,sn,displayName

Now open the CSV and make appropriate modifications in the userPrincipalName and DN attributes of all the users. Create similar OU structure in the target domain and run the following command to import the users.

csvde -i -j c:\ -f c:\users.csv -v -k


I understand that this is a very hard way of doing because of the manual combing of all the user accounts. However you would come accross many unused accounts and get rid of them instead of importing all the junk from the old domain to the new domain.
Avatar of slackerUH

ASKER

Thanks for the info.  This may lead me to a much easier solution.  I have some more questions now.