Recipe 12.1 Determining if Two Domain Controllers Are in Sync

12.1.1 Problem

You want to determine if two domain controllers are in sync and have no objects to replicate to each other.

12.1.2 Solution

12.1.2.1 Using a command-line interface

By running the following two commands you can compare the up-to-dateness vector on the two DCs:

> repadmin /showutdvec <DC1Name> <NamingContextDN> > repadmin /showutdvec <DC2Name> <NamingContextDN>

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

> repadmin /showvector <NamingContextDN> <DC1Name> > repadmin /showvector <NamingContextDN> <DC2Name>
12.1.2.2 Using VBScript
' This code prints the up-to-dateness vector for the DCs defined in ' the array arrDCList for the naming context defined by strNCDN ' ------ SCRIPT CONFIGURATION ------ ' Set to the DN of the naming context you want to check the DCs against strNCDN = "<NamingContextDN>"   ' e.g. dc=amer,dc=rallencorp,dc=com ' Enter 2 or more DCs to compare arrDCList = Array("<DC1Name>","<DC2Name>") ' ------ END CONFIGURATION --------- set objIadsTools = CreateObject("IADsTools.DCFunctions") for each strDC in arrDCList    WScript.Echo "Replication partner USNs for " & strDC & ":"    intUSN = objIadsTools.GetHighestCommittedUSN(Cstr(strDC),0)    if intUSN = -1 then       Wscript.Echo "Error retrieving USN: " & objIadsTools.LastErrorText       WScript.Quit    end if    WScript.Echo vbTab & strDC & " = " & intUSN    intRes = objIadsTools.GetReplicationUSNState(Cstr(strDC), _                                                  Cstr(strNCDN),0,0)    if intRes = -1 then       Wscript.Echo "Error retrieving USNs: " & objIadsTools.LastErrorText       WScript.Quit    end if    for count = 1 to intRes       WScript.Echo vbTab & objIadsTools.ReplPartnerName(count) & _                  " = " & objIadsTools.ReplPartnerUSN(count)     next    WScript.Echo next

12.1.3 Discussion

To determine if two or more DCs are in sync from a replication standpoint, you need to compare their up-to-dateness vectors. Each domain controller stores what it thinks is the highest update sequence number (USN) for every DC that replicates a naming context. This is called the up-to-dateness vector. If you want to compare DC1 and DC2, you'd first want to get the up-to-dateness vector for DC1 and compare DC1's highest USN against what DC2 thinks DC1's highest USN is. If they are different, then you can deduce that DC2 has not replicated all the changes from DC1 yet. Next, compare the reverse to see if DC1 is in sync with DC2.

12.1.4 See Also

See IadsTools.doc in the Support Tools for more information on the IADsTools interface



Active Directory Cookbook
Active Directory Cookbook, 3rd Edition
ISBN: 0596521103
EAN: 2147483647
Year: 2006
Pages: 456

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net