Purpose :

In some cases (lingering objects, corruption), an Active Directory partition needs to be rehosted. This technique allows you to “re-host” a partition on an Active Directory domain controller without dumping all the other read only partitions (like you would by simply un-checking the global catalog option). It saves time, replication traffic and reduces the impact on your domain controller in cases where you believe you have invalid data hosted on a particular server (http://blogs.msdn.com/b/canberrapfe/archive/2012/04/14/un-hosting-amp-re-hosting-active-directory-partitions.aspx)

Description:

I have written this script to automate the rehosting task of an Active Directory partition in a complex forest/site infrastructure. The first step before using this script is to build a configuration file with the domain controllers that need a rehost. To be clear, I will use the following example :

In that structure, all the domain controllers on the forest wide are Global Catalogs. Each domain belongs to a specific Active Directory site. I need to rehost the partition “dc=child2,dc=root,dc=com”.

The domain controllers of the domain child2.root.com have a valid partition. I will use for the rehost one of the child2.root.com domain controller as a valid source. For this example, the valid source will be :

server1.child2.root.com

This is the list of the domain controllers that need a rehosting of the partition “dc=child2,dc=root,dc=com” :

server1.root.com

server2.root.com

server3.root.com

server1.child1.root.com

server2.child1.root.com

server3.child1.root.com

server1.sub1.child1.root.com

server2.sub1.child1.root.com

server3.sub1.child1.root.com

server1.sub2.child1.root.com

server2.sub2.child1.root.com

server3.sub2.child1.root.com

server1.sub3.child1.root.com

server2.sub3.child1.root.com

server3.sub3.child1.root.com

To avoid an impact on the production, there is at least one Global catalog available in a domain/site. These are the configuration files and the schedule plan for the rehost :