# encoding: ascii
# api: powershell
# title: Replicate-ADDS
# description: Forces Replication of all DCs in the current Logon Domain.
# version: 0.1
# type: script
# author: Chris
# license: CC0
# x-poshcode-id: 2445
# x-archived: 2012-11-25T05:47:30
# x-published: 2012-01-06T13:40:00
#
#
# Transcribe output to log
$null = Start-Transcript "$pwd\$([System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Definition)).log"
# Check the QAD snapins are installed
if ( (Get-PSSnapin -Name Quest.ActiveRoles.ADManagement -ErrorAction silentlycontinue) -eq $null ) {
# The QAD snapin is not active. Check it's installed
if ( (Get-PSSnapin -Name Quest.ActiveRoles.ADManagement -Registered -ErrorAction SilentlyContinue) -eq $null) {
Write-Error "You must install Quest ActiveRoles AD Tools to use this script!"
} else {
Write-Host "Importing QAD Tools"
Add-PSSnapin -Name Quest.ActiveRoles.ADManagement -ErrorAction Stop
}
}
Write-Host "Beginning ADDS Replication"
Write-Host "=========================="
Get-QADComputer -ComputerRole 'DomainController' | % {
Write-Host "Replicating $($_.Name)"
$null = repadmin /kcc $_.Name
$null = repadmin /syncall /A /e $_.Name
}
Write-Host "=========================="
Write-Host "Completed ADDS Replication"
Stop-Transcript