Copy OU structure from one domain to another domain

Sometimes I have the need to copy the organizational units (OU) structure from one domain to another. This is one way to do it with PowerShell.

Start off by getting all the OUs that is going to be copied from one domain to the other and put them into a text file. Below is one way to do it.

Open the file an do a “search and replace” and change the “DC=LAB,DC=SE” to fit the domain to copy to.

Copy the changed file to the folder C:\temp on a server with the “activedirectory” PowerShell module installed.

When this is done run the following PowerShell script to add the OUs.

 

No comments yet.

Leave a Reply