30 lines
931 B
PowerShell
30 lines
931 B
PowerShell
<#
|
|
.SYNOPSIS
|
|
Sync all DC in a Forest
|
|
.DESCRIOTION
|
|
Sync all sites and services in a domain
|
|
.INPUTS
|
|
No Input needed
|
|
.OUTPUTS
|
|
Return a list of last sync elements
|
|
.EXAMPLE
|
|
PS> Replicate-ADSitesAndServices
|
|
Server LastReplicationSuccess
|
|
------ ----------------------
|
|
DC01.dev.intra 14.02.2022 09:07:48
|
|
DC01.dev.intra 14.02.2022 09:07:47
|
|
DC02.dev.intra 14.02.2022 09:07:53
|
|
DC02.dev.intra 14.02.2022 09:07:44
|
|
DC03.dev.intra 14.02.2022 09:07:41
|
|
DC03.dev.intra 14.02.2022 09:07:56
|
|
|
|
#>
|
|
function Replicate-ADSitesAndServices {
|
|
(Get-ADDomainController -Filter *).Name | ForEach-Object {
|
|
repadmin /syscall $_ (Get-ADDomain).DistinguishedName /e /A | Out-Null
|
|
}
|
|
Start-Sleep 10;
|
|
Get-ADReplicationPartnerMetadata -Target "$env:USERDNSDOMAIN" -Scope Domain | Select-Object Server,LastReplicationSuccess
|
|
}
|
|
|
|
Export-ModuleMember -Function Replicate-ADSitesAndServices |