Audit Hyper-V replication
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
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
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- Stage 1Get-VMReplication
Positional values or no named parameters - Stage 2Select-Object
Positional 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.
- 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.