Use This Script to Push or Pull Replication for a Windows Domain Controller (2003, 2008, 2012)


Use This Script to Push or Pull Replication for a Windows Domain Controller (2003, 2008, 2012)

If you would like to avoid using the AD Sites and Services GUI to force replication across your domain controllers, consider the script below. Save this as a .bat file to a machine on the same domain as your domain controllers and run as a domain administrator.

The script will prompt you for the desired action, push or pull (default is pull), and then it will prompt you for the domain controller you wish to pull to or push from. You can use the simple hostname or FQDN.

After finishing, the script will pause allowing you to review the results. You can also run repadmin /showrepl on your target domain controller(s) to confirm successful replication. Let me know if you have any questions or suggestions:

The Script

@echo off

GOTO push_or_pull

set /p action="Push or Pull or Quit [pull]: " || set action=pull

IF /i %action% == pull GOTO pull_process
IF /i %action% == push GOTO push_process
IF /I %action% == quit GOTO end
IF /I %action% == q GOTO end
IF /i NOT %action% == pull GOTO invalid_input

echo "Try again."
GOTO push_or_pull

REM Pulls replication from other DCs across all sites to entered DC
set /p dc="Enter DC to pull replication to: "
repadmin /syncall %dc% dc=worthave,dc=local /d /e /a /A
GOTO end

REM Pushes replication all DCs across all sites from entered DC
set /p dc="Enter DC to push replication from: "
repadmin /syncall %dc% dc=worthave,dc=local /d /e /a /A /P
GOTO end


More About the Author

Tim Rhymer

Solutions Architect
To Infinity and Beyond: The Power of the Cloud in IT As we hit refresh on a new month, new year and new decade, it makes sense for us to look back on the road that brought us to where we ...
How to Use Kaseya to Detect Meltdown and Spectre Vulnerable Machines To help detect client Windows machines that are vulnerable to Meltdown and Spectre at the OS and Hardware level, we built a Kaseya ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072


Love our blog? You should see our emails. Sign up for our newsletter!