Add Replicate-ADSitesAndServices command

This commit is contained in:
Haug, Christoph 2022-02-14 09:19:59 +01:00
parent a95bd7ba8a
commit 98c6db773b

30
ADX/ADX.psm1 Normal file
View File

@ -0,0 +1,30 @@
<#
.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