O'Reilly logo

Active Directory Cookbook by Robbie Allen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.1. Determining if Two Domain Controllers Are in Sync

Problem

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

Solution

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>

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required