Click here to Skip to main content
13,257,667 members (64,207 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 23 Sep 2003

Force Domain Controller Replication

, 29 Sep 2003
Rate this:
Please Sign up or sign in to vote.
Force Replication in a Windows AD enterprise network.


One of the problems in a W2000 Enterprise environment is that replication of Active Directory information can take a while (according to the site information). This is specially a problem during unattended installs. The problem is that this is not really easily available in W2000. Many administrators miss this functionality when migrating from NT4 to 2000. There is a tool in W2000 which allows to replicate one domain controller with another one, but using this with many ADs is not very handy. You would have to maintain a batch file with a line per DC. The tool to replicate DC information is repadmin.


To solve this problem I made this simple VB Script. It simply reads all the DCs from AD using LDAP and fires the replication tools in separate command boxes, this makes it also multi-treaded ;-)

Copy the following text in a VBS file and alter the following things:

  • MyMainDC -> Main Domain Controller Name
  • -> Your domain
  • dc=mydomain,dc=com -> Your domain

The MyMainDC is to avoid the Main Domain Controller to synchronize with itself.

Run this script file any time you want to replicate the whole domain.

For me, this was enough to overcome my problems. Another option would be to take the site information in consideration. Because this is not done here, it could be that you have to run this script twice. Maybe I will change that one day.

' Replicate.vbs
' (c) 2003, Computech, Author: Peter Verijke
Option Explicit

Dim objDSE, strDN, objContainer, objChild, sCommand, WshShell

Set objDSE = GetObject("LDAP://rootDSE")
strDN = "OU=Domain Controllers," & objDSE.Get("defaultNamingContext")

Set objContainer = GetObject("LDAP://" & strDN)

sCommand = "%COMSPEC% /C " 
Set WshShell = WScript.CreateObject("WScript.Shell")

objContainer.Filter = Array("Computer")
For Each objChild In objContainer
    if Ucase(mid(objChild.Name,4)) <> "MyMainDC" then
        WshShell.Run(sCommand & "if exist \\" & _ 
           mid(objChild.Name,4) & "\Sysvol repadmin /syncall " _ 
           & mid(objChild.Name,4) & _ 
           " dc=mydomain,dc=com /force")
    end if


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Peter Verijke
Founder Computech bvba
Belgium Belgium
I´m a freelance ICT consultant and Technical Project Manager for the last 15 years already.
Before that, I was a Software Developer for the Pharmaceutical and Petrochemical industry.
I developed a very wide knowledge in the ICT world due to my intrest.
This includes Networking (Lan, Wan), Routing Switching Bridging, etc...
Windows environment, which has no secrets for me.
Developing: To many languages to mension here.
Of course, the latest one on the list is dot net.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 30 Sep 2003
Article Copyright 2003 by Peter Verijke
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid