Recipe 12.4 Forcing Replication from One Domain Controller to Another

12.4.1 Problem

You want to force replication between two partners.

12.4.2 Solution

12.4.2.1 Using a graphical user interface
  1. Open the Active Directory Sites and Services snap-in.

  2. Browse to the NTDS Setting object for the domain controller you want to replicate to.

  3. In the right pane, right-click on the connection object to the domain controller you want to replicate from and select Replicate Now.

12.4.2.2 Using a command-line interface

The following command will perform a replication sync of the naming context specified by <NamingContextDN> from <DC2Name> to <DC1Name>:

> repadmin /replicate <DC1Name> <DC2Name> <NamingContextDN>

The Windows 2000 version of repadmin has a different syntax to accomplish the same thing. Here is the equivalent syntax:

> repadmin /sync <NamingContextDN> <DC1Name> <DC2GUID>
12.4.2.3 Using VBScript
' This code initiates a replication event between two DCs
' for a naming context
' ------ SCRIPT CONFIGURATION ------
strDC1Name = "<DC1Name>"   ' e.g. dc1 
strDC2Name = "<DC2Name>"   ' e.g. dc2
strNamingContextDN = "<NamingContextDN>"  ' e.g. dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------

set objIadsTools = CreateObject("IADsTools.DCFunctions")
intRes = objIadsTools.ReplicaSync(Cstr(strDC1Name),_
                                  Cstr(strNamingContextDN),_ 
                                  Cstr(strDC2Name), 0, 0)
if intRes = -1 then
   Wscript.Echo "Error: " & objIadsTools.LastErrorText
else
   WScript.Echo "Replication intitiated from " & strDC2Name & _
                " to " & strDC1Name
end if

12.4.3 Discussion

Each solution shows how to replicate all unreplicated changes from a source domain controller to a destination domain controller. This sync is one way. If you want to ensure that both domain controllers are in sync, you'll need to follow the same directions except swap the domain controllers.

With repadmin you can replicate a single object instead of any unreplicated object in a naming context by using the /replsingleobj option. This option is only available with the Windows Server 2003 version of repadmin.

12.4.4 See Also

Recipe 12.3 for viewing unreplicated changes between two domain controllers, MS KB 232072 (Initiating Replication Between Active Directory Direct Replication Partners), and see IadsTools.doc in the Support Tools for more information on the IADsTools interface



    Chapter 3. Domain Controllers, Global Catalogs, and FSMOs
    Chapter 6. Users
    Appendix A. Tool List