Replicate Active Directory

0

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

About Author

My name is Ronni Pedersen and I'm currently working as a Cloud Architect at APENTO in Denmark. My primary focus is Enterprise Client Management solutions, based on technologies like AzureAD, Intune, EMS and System Center Configuration Manager. I'm is also a Microsoft Certified Trainer and Microsoft MVP in Enterprise Mobility.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.