[ Team LiB ] |
Recipe 12.3 Viewing Unreplicated Changes Between Two Domain Controllers12.3.1 ProblemYou want to find the unreplicated changes between two domain controllers. 12.3.2 Solution12.3.2.1 Using a graphical user interface
12.3.2.2 Using a command-line interfaceRun the following two commands to find the differences between two domain controllers. Use the /statistics option to view a summary of the changes: > repadmin /showchanges <DC1Name> <DC2GUID> <NamingContextDN> > repadmin /showchanges <DC2Name> <DC1GUID> <NamingContextDN> The Windows 2000 version of repadmin has a different syntax to accomplish the same thing. Here is the equivalent syntax: > repadmin /getchanges <NamingContextDN> <DC1Name> <DC2GUID> > repadmin /getchanges <NamingContextDN> <DC2Name> <DC1GUID> 12.3.2.3 Using VBScript' This code uses the IADsTools interface to print the unreplicated ' changes for the naming context defined by strNCDN for the DCs ' defined by strDC1Name and strDC2Name ' ------ SCRIPT CONFIGURATION ------ strNCDN = "<NamingContextDN>" ' e.g. dc=rallencorp,dc=com strDC1Name = "<DC1Name>" ' e.g. dc1.rallencorp.com strDC2Name = "<DC2Name>" ' e.g. dc2.rallencorp.com ' ------ END CONFIGURATION --------- set objIadsTools = CreateObject("IADsTools.DCFunctions") ' ---------------------------------- ' Have to get the GUIDs of both servers in order to identify ' the correct partner in the GetReplicationUSNState call ' ---------------------------------- strDC1GUID = objIadsTools.GetGuidForServer(Cstr(strDC1Name), _ Cstr(strDC1Name),0) strDC2GUID = objIadsTools.GetGuidForServer(Cstr(strDC2Name), _ Cstr(strDC2Name),0) ' ---------------------------------- ' Need to get what each DC thinks is the highest USN for the other ' The USN is needed in the call to GetMetaDataDifferences to return ' the unreplicated changes ' ---------------------------------- intRes = objIadsTools.GetReplicationUSNState(Cstr(strDC1Name), _ Cstr(strNCDN),0,0) if intRes = -1 then Wscript.Echo objIadsTools.LastErrorText WScript.Quit end if for count = 1 to intRes if strDC2GUID = objIadsTools.ReplPartnerGuid(count) then intDC2USN = objIadsTools.ReplPartnerUSN(count) end if next if intDC2USN = "" then WScript.Echo strDC2Name & " is not a replication partner with " & _ strDC1Name end if intRes = objIadsTools.GetReplicationUSNState(Cstr(strDC2Name), _ Cstr(strNCDN),0,0) if intRes = -1 then Wscript.Echo objIadsTools.LastErrorText WScript.Quit end if for count = 1 to intRes if strDC1GUID = objIadsTools.ReplPartnerGuid(count) then intDC1USN = objIadsTools.ReplPartnerUSN(count) end if next if intDC2USN = "" then WScript.Echo strDC1Name & " is not a replication partner with " & _ strDC2Name end if ' ---------------------------------- ' Now that we have retrieved the highest USN for both partners, ' the GetMetaDataDifferences method will return what needs to be ' replicated ' ---------------------------------- intRes = objIadsTools.GetMetaDataDifferences(Cstr(strDC1Name), _ Cstr(intDC1USN), _ Cstr(strNCDN),0) if intRes = -1 then Wscript.Echo objIadsTools.LastErrorText WScript.Quit end if WScript.Echo "Data on " & strDC1Name & " but not " & strDC2Name & ":" for count = 1 to intRes WScript.Echo count & ". " & _ objIadsTools.MetaDataDifferencesObjectDN(count) WScript.Echo vbTab & " Attribute: " & _ objIadsTools.MetaDataDifferencesAttribute(count) WScript.Echo vbTab & " Write time: " & _ objIadsTools.MetaDataDifferencesLastWriteTime(count) WScript.Echo vbTab & " Orig Server: " & _ objIadsTools.MetaDataDifferencesOrigServer(count) WScript.Echo vbTab & " Orig USN: " & _ objIadsTools.MetaDataDifferencesOrigUSN(count) next WScript.Echo intRes = objIadsTools.GetMetaDataDifferences(Cstr(strDC2Name), _ Cstr(intDC2USN), _ Cstr(strNCDN), 0) if intRes = -1 then Wscript.Echo objIadsTools.LastErrorText WScript.Quit end if WScript.Echo "Data on " & strDC2Name & " but not " & strDC1Name & ":" for count = 1 to intRes WScript.Echo count & ". " & _ objIadsTools.MetaDataDifferencesObjectDN(count) WScript.Echo vbTab & " Attribute: " & _ objIadsTools.MetaDataDifferencesAttribute(count) WScript.Echo vbTab & " Write time: " & _ objIadsTools.MetaDataDifferencesLastWriteTime(count) WScript.Echo vbTab & " Orig Server: " & _ objIadsTools.MetaDataDifferencesOrigServer(count) WScript.Echo vbTab & " Orig USN: " & _ objIadsTools.MetaDataDifferencesOrigUSN(count) next 12.3.3 DiscussionAll three solutions show how to display the current unreplicated changes between two domain controllers. The repadmin /showchanges command has several additional options you can use to display the changes, including saving the output to a file for later comparison. Also, with the /statistics option, you can view a summary of the changes. 12.3.4 See AlsoSee IadsTools.doc in the Support Tools for more information on the IADsTools interface |
[ Team LiB ] |