best business builder

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

one click social media designs

Leave a Reply

Your email address will not be published. Required fields are marked *