PowerShell Genie

Audit Hyper-V replication

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Get-VMReplication returns the replication configuration for each participating guest, and the projection keeps the VM name with State, Health, and LastReplicationTime.

The script

1PS> Get-VMReplication | Select-Object VMName,State,Health,LastReplicationTime

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 VMName State Health LastReplicationTime
    2 ------ ----- ------ -------------------
    3 VM-DEMO Running Normal 9/10/2026 11:30:00 AM
    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.

    Get-VMReplication | Select-Object VMName,State,Health,LastReplicationTime
    1. Stage 1Get-VMReplicationPositional values or no named parameters
    2. Stage 2Select-ObjectPositional values or no named parameters

      How it works

      Get-VMReplication returns the replication configuration for each participating guest, and the projection keeps the VM name with State, Health, and LastReplicationTime. Health is the summary field, and that timestamp is what reveals how much data a failover would cost.

      Adapting it

      Filter on Health -ne 'Normal' to reduce this to an exception list suitable for a daily check, which is the only form worth scheduling.

      Requirements

      Hyper-V PowerShell module on a host participating in replication.

      If the result is unexpected

      A Hyper-V replication report looks healthy while a replica is behind.

      Replication health and last successful replication time answer different questions.

      1. Inspect replication state, health and timing for the affected VM and its partner.

      Validate the result

      The partner and last replication evidence meet the recovery requirement.

      Keep the check reliable

      Alert on lag as well as state, with workload-specific thresholds.

      Primary documentation

      Windows services and processes documentation

      Continue
      Genie guideAudit Hyper-V replication

      Get-VMReplication returns the replication configuration for each participating guest, and the projection keeps the VM name with State, Health, and LastReplicationTime.