PoshCode Archive  Artifact Content

Artifact 3b993c21399005210c83d2dbb941f60e433ca840b11a87ff2c847aa2dfccc710:

  • File Replicate-ADDS.ps1 — part of check-in [2acefd710c] at 2018-06-10 13:10:23 on branch trunk — Forces Replication of all DCs in the current Logon Domain. (user: Chris size: 1321)

# 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