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

IT

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

: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

:invalid_input
echo "Try again."
GOTO push_or_pull

:pull_process
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

:push_process
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

:end
pause

More About the Author

Tim Rhymer

Systems Engineer
Protect Tableau Server for Free with Let’s Encrypt (Windows) These days, there isn’t really an excuse to not protect all the things with some form of encryption. If your web server supports ...
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 →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

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
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

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