Click here to Skip to main content
Click here to Skip to main content

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.

Introduction

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.

Solution

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 Wink | ;-)

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

  • MyMainDC -> Main Domain Controller Name
  • mydomain.com -> 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) & _ 
           ".mydomain.com dc=mydomain,dc=com /force")
    end if
Next

License

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

Share

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.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.140826.1 | Last Updated 30 Sep 2003
Article Copyright 2003 by Peter Verijke
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid