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