PowerShell Genie

PowerShell AD replication

Investigate a specific replication partner and partition before attempting recovery.

Lesson 2 min read Windows PowerShell 5.1 and PowerShell 7

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
  1. Stage 1[pscustomobject]@{Positional values or no named parameters
  2. Stage 2Format-ListPositional 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-List

    What 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

    Microsoft Learn: get-adreplicationpartnermetadata

    Try it

    Expected output · prints command text; does not execute these commands

    1PS> [pscustomobject]@{
    2PS> Failures = 'Get-ADReplicationFailure -Target DC01'
    3PS> Status = 'Get-ADReplicationPartnerMetadata -Target * -Partition *'
    4PS> Force = 'Sync-ADObject -Object <dn> -Source DC01 -Destination DC02'
    5PS> Legacy = 'repadmin /replsummary'
    6PS> } | Format-List

    Example reader

    Inspect this page's example

    Fictional browser data when supported

    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 roles

      Check your understanding

      One partner has an old LastReplicationSuccess value. Is a successful query enough to declare replication healthy?

      Genie guidePowerShell AD replication

      Investigate a specific replication partner and partition before attempting recovery.