Powershell or VB codes to replicate between DC

Asked By 7060 points N/A Posted on -
qa-featured

Any script that we can use to replicate between Dc's.

I want to force replicate Can anyone help me with a script preferably Powershell or VBS.

I can schedule it to run and can have it replicated as I want.
SHARE
Best Answer by Sharath Reddy
Best Answer
Best Answer
Answered By 551815 points N/A #79185

Powershell or VB codes to replicate between DC

qa-featured

Here is a script that can be used to force replicate between your domain controllers.

  1. Use this Power shell script.
  2. Save it and add it as a scheduled task to run.
  3. You need to edit the 2 lines with your server details.
  4. Line 1 & Line 2 portions that are in RED.

$domain = "Domain.local"
$servers = "Dc1","Dc2","DC3","DC4"
$context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain",$domain)
$dclist = [System.DirectoryServices.ActiveDirectory.DomainController]::findall($context)
foreach($srv in $servers)
{
    Write-Host "Force Replicate on $Srv"
    $dc = $dclist | ?{$_.Name -match $srv}
    $dc.SyncReplicaFromAllServers(([ADSI]"").distinguished Name,'CrossSite')
}

Let me know if you would need a VBS solution so can write a short script to do it.

Answered By 60 points N/A #79186

Powershell or VB codes to replicate between DC

qa-featured

 

Thanks Mr.Sharath,
 
And also thanks for the script. You really helped me in this problem. I have registered so many accounts in site like this for finding script for force replicate between Dc's. This site really helped me to solve my problem.
 
Many thanks to Mr.Sharath and to techyv.com experts to create a helpful website like this.
 
Regards.

Login/Register to Answer

Related Questions