Mirror an OU Structure to a Test Domain
A while back I wrote a couple of scripts for backing up Group Policies and then importing that backup into a test environment. More on those scripts here:
Comprehensive GPO Backup / Import Scripts
Notice the use of 'comprehensive' in the script titles. I chose this word because there were a couple of things the scripts didn't do. One of those things was to mirror the OU structure of the source domain to the target domain. This is no longer an issue...
Let me introduce a couple of companion scripts to ensure we have a matching OU structure in the test environment:
The names give the script functions away:
- the first script dumps the OU name, OU DN, OU parent DN and domain DN to an XML file
- the second script reconstructs the OU structure in a target test domain
No OUs were hurt in the production of this post...
Comments
- Anonymous
April 24, 2015
With Windows Server 2012 R2 we get a new, 'bad-boy' constructed attribute... - Anonymous
December 14, 2015
These scripts worked to perfection for me. Many thanks for sharing your knowledge! I was even able to use your Dump AD User script to dump AD Groups. (However, I was not able to modify the Mirror AD User script to mirror the groups I exported to XML). Any chance of us seeing a Dump/Mirror AD Group script?!?!