How to Configure Hyper-V Virtual Machine Replication in Windows 11 Using PowerShell

In virtualized disaster recovery planning, maintaining warm standby copies of critical virtual machines across physical hosts ensures business continuity in the event of hardware failure or storage corruption. In Microsoft Hyper-V on Windows 11 Pro, Enterprise, and Windows Server, this protection is achieved through Hyper-V Replica. Hyper-V Replica provides asynchronous, storage-agnostic replication over standard IP networks without requiring expensive shared SAN hardware. Once an initial baseline copy is transferred, Hyper-V continuously replicates virtual hard disk write logs at configurable intervals. Managing replication policies via PowerShell provides automation for initial synchronization, compression, and test failover routines.

Understanding Hyper-V Replica Architecture

Hyper-V Replica operates at the virtual disk VHDX logging layer:

  • Change Tracking: When replication is active, Hyper-V creates an in-memory change tracking log (HRL file) capturing all write I/O operations occurring on the primary virtual machine’s disks.
  • Configurable Intervals: Changes are bundled and transmitted to the replica host asynchronously at intervals of 30 seconds, 5 minutes (default), or 15 minutes.
  • Authentication Channels: Replication supports unencrypted Kerberos authentication (HTTP port 80) across trusted Active Directory domains, or mutual certificate-based TLS authentication (HTTPS port 443) for standalone workgroups and untrusted networks.
  • Compression: Built-in network compression reduces bandwidth consumption across WAN connections.

Configuring the Destination Replica Server

Before configuring a primary virtual machine to replicate, the destination Hyper-V host must be designated as an authorized replica server:

# Enable the host as a Hyper-V Replica Server using Kerberos authentication
Set-VMReplicationServer -ReplicationEnabled $True `
    -AllowedAuthenticationType Kerberos `
    -ReplicationAllowedLocations "D:\Hyper-V\Replicas" `
    -DefaultStorageMapping "D:\Hyper-V\Replicas"

# Open the necessary Windows Defender Firewall port for Kerberos replication (port 80)
Enable-NetFirewallRule -DisplayName "Hyper-V Replica HTTP Listener (TCP-In)"

If replication traverses public networks, configure certificate authentication with HTTPS listener port 443 and specify an X.509 thumbprint.

Enabling Virtual Machine Replication via PowerShell

On the primary Windows 11 host, enable replication on the target virtual machine (such as App-Server-01):

# Enable replication targeting the replica host
Enable-VMReplication -VMName "App-Server-01" `
    -ReplicaServerName "replica-host.internal.corp" `
    -ReplicaServerPort 80 `
    -AuthenticationType Kerberos `
    -CompressionEnabled $True `
    -ReplicationFrequencySec 300

The -CompressionEnabled $True switch activates real-time data stream compression before packets leave the primary network interface.

Initiating the Initial Virtual Machine Baseline Sync

Enabling replication establishes the configuration link, but physical disk synchronization must be explicitly triggered:

# Start the initial disk synchronization over the network immediately
Start-VMInitialReplication -VMName "App-Server-01"

For multi-terabyte virtual disks across bandwidth-constrained networks, Hyper-V allows exporting the initial baseline copy to external media using -DestinationPath rather than replicating live over the wire.

Adjusting Replication Frequency and Retention Windows

To reduce potential data loss (Recovery Point Objective / RPO) for high-transaction workloads, reduce the replication frequency down to 30 seconds:

# Adjust replication interval to 30 seconds
Set-VMReplication -VMName "App-Server-01" -ReplicationFrequencySec 30

# Configure hourly recovery points to preserve historical snapshots for ransomware recovery
Set-VMReplication -VMName "App-Server-01" -RecoveryHistory 24

Monitoring Replication Health and Performance Telemetry

To audit whether replication is progressing smoothly without falling behind schedule:

# Inspect replication health across all virtual machines
Get-VMReplication -VMName * | Select-Object VMName, ReplicationHealth, ReplicationMode, CurrentReplicaServerName, LastReplicationTime

To retrieve granular transmission metrics, including average latency and dropped cycles:

# Query detailed replication statistics
Measure-VMReplication -VMName "App-Server-01"

Key metrics in Measure-VMReplication include ReplicationSuccessCount, ReplicationFailureCount, and AverageReplicationSize.

Executing a Non-Disruptive Test Failover

Disaster recovery plans must be audited periodically without taking production services offline. Hyper-V Replica allows creating a sandboxed test clone from the latest replica snapshot:

# On the replica server: initiate a test failover without stopping the primary VM
Start-VMFailover -VMName "App-Server-01" -AsTest

# Connect to the created "App-Server-01 - Test" virtual machine to verify OS integrity
Get-VM -Name "*Test*"

Once testing and database integrity verification conclude, decommission the test environment cleanly:

# Stop the test failover and delete the ephemeral test disk clone
Stop-VMFailover -VMName "App-Server-01"

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.