In a previous article I discussed my need for instant gratification when it comes to replicating my DC’s. I gave an example of a script that would replicate all the DC’s that are manually programmed into it.
Well, here is a solution that will find the DC’s on its own and then update each DC with its respective partner. A much simpler and elegant solution if I do say so myself!
repadmin /viewlist * | Foreach-Object `
$StrDCName = ([regex]::match($_,"(?<=DSA_LIST\[\d?\]\s\=\s).+").value)
Write-Host "Processing "$StrDCName -for Green
repadmin /kcc $StrDCName
repadmin /syncall /A /e $StrDCName
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")