How to disable the Knowledge Consistency Checker inter-site topology generation for all sites (245610)



The information in this article applies to:

  • Microsoft Windows Server 2003, Standard Edition
  • Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Windows Server 2003, Datacenter Edition
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Datacenter Server

This article was previously published under Q245610

SUMMARY

The Knowledge Consistency Checker (KCC) is a Windows component that automatically generates and maintains the intra-site and inter-site replication topology. You can disable the KCC's automatic generation of intra-site or inter-site topology management, or both. You can use the script included in this article to automate disabling or the re-enabling of automatic inter-site topology maintenance that the KCC performs. For additional information about the effects of disabling the KCC, click the following article number to view the article in the Microsoft Knowledge Base:

242780 How to disable the Knowledge Consistency Checker from automatically creating replication topology

The script included in this article does the following:
  • Binds to the RootDSE (LDAP information local to each Windows 2000-based or Windows Server 2003-based domain controller) using LDAP.
  • Determines the local computer name.
  • Determines the name of the configuration partition of the forest.
  • Enumerates each site in Active Directory and evaluates the settings for each site to determine if the inter-site KCC functionality is currently disabled or enabled.
  • Depending on the parameter you specify when you run the script (either /enable or /disable), if the setting already reflects the desired behavior, no changes are made. Otherwise, the Active Directory object that controls the behavior for the particular site is modified to enable or disable inter-site topology generation as specified.
The changes the script makes are propagated to each domain controller throughout the forest through Active Directory replication. For each site, there is one domain controller that is responsible for maintaining the inter-site replication topology. This domain controller is referred to as the Inter-Site Topology Generator (ISTG). When the ISTG discovers this change (after replication has occurred), the KCC acts accordingly.

back to the top

Steps to Use the Script

  1. Copy the following text and paste it into Notepad:
    '*/ configkcc.vbs
    '*/  
    '*/ Parameters: /enable (to enable inter-site KCC for all Sites)
    '*/ /disable (to disable inter-site KCC for all sites)
    '*/ 
    '*/ Purpose: Enumerates all Sites for the forest that the domain controller
    '*/ where this script runs is a member and disables inter-site topology generation
    '*/ maintenance. This data is changed on one domain controller and relies
    '*/ on Active Directory replication to replicate this change to the Inter-Site Topology
    '*/ Generator (ISTG) in other sites. Once the ISTG receives this change, the KCC will
    '*/ cease to maintain inter-site connection maintenance.
    '*/ 
    
    On Error Resume Next
    
    'get the parameters
    Set Args = WScript.Arguments
    if Args.Count=0 then DisplayHelp():Wscript.Quit
    If lcase(Args(0))="/enable" or lcase(Args(0))="/disable" then
    Call ConfigureKCC()
    else
    DisplayHelp()
    end if
    
    Public Sub ReportError ()
    
    'tell the user the error
    wscript.Echo "The following error occurred: (" + cstr(hex(err.number)) +") " + cstr(err.description)
    
    End Sub
    
    Public Sub DisplayHelp ()
    wscript.echo "Either no parameters were supplied or the parameters were incorrect."
    wscript.echo " Use:"
    wscript.echo " cscript configkcc.vbs /enable  (to enable inter-site KCC for all Sites)"
    wscript.echo " cscript configkcc.vbs /disable (to disable inter-site KCC for all Sites)"
    
    End Sub
    
    Public Sub ConfigureKCC ()
    
    On Error Resume Next
    
    'get the local box name
    wscript.echo "Connecting to local machine..."
    set localMachine=GetObject("LDAP://localhost/rootdse")
    if err.number <> 0 then ReportError:Wscript.Quit
    ServerName=localmachine.get("dnsHostName")
    if err.number <> 0 then ReportError:WScript.Quit
    wscript.echo "Found local machine " + ucase(ServerName)
    
    'get the config NC
    configNC=localMachine.get("configurationNamingContext")
    if err.number <> 0 then ReportError:Wscript.Quit
    wscript.echo "Configuration Directory Partition is: " + configNC
    
    'bind to the Sites container
    Set ObjSites = GetObject("LDAP://" & ServerName & "/CN=Sites," & configNC)
    objSites.filter = array("Site")
    For each obj in ObjSites
    wscript.echo "Site Name: " + obj.CN
    Set SiteSettings = Obj.GetObject("nTDSSiteSettings", "CN=NTDS Site Settings")
    
    'get the current options
    origOptions=SiteSettings.Get("options")
    if hex(err.number) = "8000500D" then
    origOptions=0
    elseif err.number=0 then
    'do nothing
    else
    ReportError:Wscript.Quit
    end if
    modOptions=origOptions
    
    'determine if we should enable or disable the KCC on each pass
    if lcase(Args(0))="/disable" then	
    'disable the KCC if currently enabled, otherwise, leave it alone
    if modOPtions And 16 then
    wscript.echo " KCC currently disabled for inter-site topology generation.  No change required."
    else
    mod2Options=modOptions Or 16
    wscript.echo " KCC currently enabled for inter-site topology generation.  Modifying."
    SiteSettings.Put "options", mod2Options
    SiteSettings.SetInfo
    if err.number <> 0 then
    'if the value didn't already exist, this is ok
    if hex(err.number) = "8000500D" then
    'we write the value anyway
    else
    ReportError
    wscript.echo "An error occurred during the process of modifying the options attribute."
    wscript.echo "Check to make sure that it has the correct original value."
    wscript.echo "This script is terminating."
    Wscript.Quit
    end if
    end if
    end if
    else
    'enable the KCC if currently disabled, otherwise, leave it alone
    if modOPtions And 16 then
    wscript.echo " KCC currently disabled for inter-site topology generation.  Modifying."
    mod2Options=modOptions XOr 16
    SiteSettings.Put "options", mod2Options
    SiteSettings.SetInfo
    if err.number <> 0 then
    'if the value didn't already exist, this is ok
    if hex(err.number) = "8000500D" then
    'we write the value anyway
    else
    ReportError
    wscript.echo "An error occurred during the process of modifying the options attribute."
    wscript.echo "Check to make sure that it has the correct original value."
    wscript.echo "This script is terminating."
    Wscript.Quit
    end if
    end if
    else
    wscript.echo " KCC currently enabled for inter-site topology generation.  No change required."
    end if
    end if
    Next
    
    End Sub
    
    'end script
    					
  2. Save the file with a .vbs extension.
  3. Log on to a domain controller with an account that is a member of the Enterprise Admins group.
  4. Open a command prompt window and use the appropriate syntax to start the script:
    • To configure the KCC to not maintain inter-site replication topology, type the following command:

      cscript.exe filename.vbs /disable

    • To configure the KCC to re-enable automatic inter-site replication topology maintenance, type the following command:

      cscript.exe filename.vbs /enable

As the script progresses, output is displayed in the command prompt detailing the script's progress.

back to the top

Modification Type:MajorLast Reviewed:10/26/2004
Keywords:kbenv kbHOWTOmaster kbProgramming KB245610 kbAudITPro