customer relationships

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

Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
one click social media designs