Active Directory Auto-Replication Script

While working in my lab I found that my replication between sites was not working as fast as I needed. So I created a script to trigger the repadmin command every 5 minutes.

Create Auto-Replication.ps1 file

  1. Open Notepad or your favorite powershell editor
  2. Type this line: 1..2094|foreach {start-sleep -s 5;cmd /c repadmin /syncall /AeP}
  3. Save file as Auto-Replication.ps1

 Change PowerShell Execution

  1. Open PowerShell Administrator Window
  2. Change execution to remotesigned: Set-ExecutionPolicy RemoteSigne


Execute the Script

  1. Now you can call your Auto-Replication.ps1 . It will run for a week before it stops.

Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

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

%d bloggers like this: