PowerShell AD replication
Investigate a specific replication partner and partition before attempting recovery.
Documentation: Microsoft Learn
Overview
A successful AD query is not a replication health check. Compare partner metadata by domain controller and naming context, then look at LastReplicationSuccess, LastReplicationResult and current failures. One healthy partition does not establish that every partition is current.
Be explicit about scope. For a domain-wide failure query, identify the domain as the target and use the matching scope. For one DC, name that DC. Record which server answered so repeated checks are comparable.
Use the reported error to choose the next check: DNS resolution, RPC connectivity, authentication, time or partner availability. A forced synchronization is not a repair for a broken dependency. Sync-ADObject is a targeted object operation, not a substitute for diagnosing the topology.
Check the forest’s actual tombstone lifetime before recovering a long-offline DC. Event 2042 and lingering objects require a supported recovery procedure; do not infer a universal 180-day limit or automatically force replication. See Microsoft’s Event 2042 guidance.
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
[pscustomobject]@{
Failures = 'Get-ADReplicationFailure -Target DC01'
Status = 'Get-ADReplicationPartnerMetadata -Target * -Partition *'
Force = 'Sync-ADObject -Object <dn> -Source DC01 -Destination DC02'
Legacy = 'repadmin /replsummary'
} | Format-List- Stage 1[pscustomobject]@{
Positional values or no named parameters - Stage 2Format-List
Positional values or no named parameters
An example to inspect
Preview the example. Sign in for the full lesson and activities.
[pscustomobject]@{
Failures = 'Get-ADReplicationFailure -Target DC01'
Status = 'Get-ADReplicationPartnerMetadata -Target * -Partition *'
Force = 'Sync-ADObject -Object <dn> -Source DC01 -Destination DC02'
Legacy = 'repadmin /replsummary'
} | Format-ListWhat happens
This example prints a command checklist. It does not contact a domain controller. A real follow-up must inspect each returned partner and partition; the presence of command text is not a health result.
Worth remembering
Confirm that successful replication timestamps advance after the repair and that relevant error codes clear across the intended scope.
Primary documentation
Try it
Expected output · prints command text; does not execute these commands
Example reader
Inspect this page's example
Run supported commands against the practice data, or inspect the example without executing it.
Ready to inspect.
Prints the replication diagnostic commands in the order to use them.
Show reference output
Expected output · prints command text; does not execute these commands
Failures : Get-ADReplicationFailure -Target DC01 Status : Get-ADReplicationPartnerMetadata -Target * -Partition * Force : Sync-ADObject -Object <dn> -Source DC01 -Destination DC02 Legacy : repadmin /replsummary
Keep going
Next: PowerShell FSMO rolesCheck your understanding
One partner has an old LastReplicationSuccess value. Is a successful query enough to declare replication healthy?
No. Inspect that partner and partition, the result code and failure history. Check the forest tombstone lifetime before recovering a long-offline DC.