From time to time I spend time on troubleshooting Active Directory and SYSVOL replication at my customers. The built in replication schedule are great, but some time it’s nice to force replication on all Domain Controllers to minimize the waiting time…
This script will force an instant replication on all domain controllers.
ReplicateAD.vbs
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
WshShell.Run(sCommand & “repadmin /syncall ” & mid(objChild.Name,4) & ” /A /e”)
Next