Hyper-V live migration and Hyper-V Replica

On a real Hyper-V host you can’t just reboot for patches: 20 VMs would go down. Hyper-V live migration moves running VMs to another host with no downtime, and Hyper-V Replica keeps a copy ready at a second site. These two features are why admins can do host maintenance in the middle of the working day.

In this lesson you’ll build a small nested lab on your laptop’s Hyper-V (a DC and two Hyper-V hosts), live migrate a running VM between hosts, set up Hyper-V Replica and run a test failover. You’ll also meet AVMA and GPU partitioning.

TimeYou needBy the end you can
About 2 hoursHyper-V on your laptop from Lesson 28, the Server 2025 ISO, and 16 GB of RAM (with 8 GB, read along)Prepare a sysprepped base disk, use PowerShell Direct, configure and run live migration, set up Replica with a test failover, and fix migration and replication errors

What it is, in one line

Hyper-V live migration moves a running virtual machine from one Hyper-V host to another while it keeps running, copying its memory across the network so users notice nothing.

In Simple Words

Moving house while the family keeps living

Imagine moving house without the family ever stopping their day. Movers copy each room to the new house while people keep using it, then copy what changed, then the little that changed again. In the last second, the family steps through a door into the new house, and everything’s already there.

Live migration does that with a VM’s memory: copy, copy the changes, copy the last bit, switch. Hyper-V Replica is different: it keeps a spare copy of the house in another town, a few minutes behind, in case the first one burns down.

One moves a running VM for maintenance. The other is for disasters.

Engineer's View

Live migration, Replica, AVMA, GPU-P

Live migration: the source copies the VM’s memory pages to the destination over TCP 6600 while the VM runs, repeats for pages that changed, then pauses the VM for a moment, sends the final state and resumes it on the destination. Options include compression (default) and SMB Direct for speed. Hosts need compatible CPUs (or processor compatibility mode), the same virtual switch names, and access to the VM’s storage.

Types: in a failover cluster the storage is shared, so only memory moves. Shared-nothing live migration moves memory and disks between standalone hosts. Authentication is Kerberos (domain hosts, with constrained delegation for remote initiation) or CredSSP.

Hyper-V Replica asynchronously copies a VM’s disk changes to another host every 30 seconds, 5 minutes or 15 minutes, over HTTP (80, Kerberos) or HTTPS (443, certificates). You can keep extra recovery points and run test failovers without touching the primary. It’s for disaster recovery, not zero downtime.

Also good to know: AVMA (Automatic Virtual Machine Activation) activates Windows Server guests on an activated Datacenter host without a KMS. GPU partitioning shares one GPU between VMs; Server 2025 supports live migration of GPU-P VMs. PowerShell Direct (Invoke-Command -VMName) runs commands inside a VM from its host with no network at all.

How it works, step by step

The three passes of a live migration:

Hyper-V live migration passes: prepare, copy memory, copy changes, brief pause, resume

The pause at the end is usually well under a second, short enough that TCP connections and RDP sessions survive. The busier the VM’s memory, the more passes it takes.

The nested lab you’ll build on your laptop:

Hyper-V live migration nested lab: HVDC, HV01, HV02 and a sysprepped base disk
  1. Base disk: install Server Core once, sysprep it, and use it as a read-only parent.
  2. Three VMs on differencing disks: HVDC (DC for hvlab.internal), HV01 and HV02 (nested Hyper-V hosts).
  3. Configure them with PowerShell Direct: addresses, domain, Hyper-V role.
  4. Live migrate a running VM from HV01 to HV02.
  5. Replicate another VM to HV02 and run a test failover.

The test VMs inside HV01 don’t need an operating system: a VM sitting at its firmware screen is running, and migrates exactly like one with Windows.

Hands-on Lab: Hyper-V live migration in a nested lab

Work on your laptop in PowerShell as administrator, with the hypervisor on (Lesson 28, step 6). Shut down VirtualBox VMs to make room in memory.

1Build a sysprepped base disk

Create a VM, install Server Core in it, then generalize it:

New-VM -Name BASE -Generation 2 -MemoryStartupBytes 2GB -NewVHDPath C:\Lab\HyperV\base.vhdx -NewVHDSizeBytes 40GB -Path C:\Lab\HyperV | Out-Null
Add-VMDvdDrive -VMName BASE -Path C:\Lab\ISO\server2025.iso
Set-VMFirmware -VMName BASE -FirstBootDevice (Get-VMDvdDrive -VMName BASE)
Start-VM BASE; vmconnect localhost BASE

Install Windows Server 2025 Datacenter Evaluation (without Desktop Experience). After setting the password, choose 15 in sconfig to reach PowerShell and run C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown. When BASE shuts down, delete the VM but keep the disk:

On your laptop:

Remove-VM BASE -Force
Set-ItemProperty C:\Lab\HyperV\base.vhdx -Name IsReadOnly -Value $true

Sysprep gives every copy a new machine SID, which avoids exactly the duplicate-SID failures from the work story in Lesson 13. The parent disk must never change again, hence read-only.

✅ Checkpoint: base.vhdx exists, is read-only, and the BASE VM is gone.

2Create three VMs on differencing disks

On your laptop:

foreach ($v in 'HVDC','HV01','HV02') {
    New-VHD -Path "C:\Lab\HyperV\$v.vhdx" -ParentPath C:\Lab\HyperV\base.vhdx -Differencing | Out-Null
    $mem = if ($v -eq 'HVDC') { 1536MB } else { 3GB }
    New-VM -Name $v -Generation 2 -MemoryStartupBytes $mem -VHDPath "C:\Lab\HyperV\$v.vhdx" -SwitchName LabPrivate -Path C:\Lab\HyperV | Out-Null
    Set-VMProcessor -VMName $v -Count 2
}
Set-VMProcessor -VMName HV01, HV02 -ExposeVirtualizationExtensions $true
Get-VMNetworkAdapter -VMName HV01, HV02 | Set-VMNetworkAdapter -MacAddressSpoofing On
Start-VM HVDC, HV01, HV02
Get-VM HVDC, HV01, HV02 | Select-Object Name, State, MemoryAssigned

You should see something like this:

Name State   MemoryAssigned
---- -----   --------------
HVDC Running     1610612736
HV01 Running     3221225472
HV02 Running     3221225472

Each differencing disk starts almost empty and stores only that VM’s changes. ExposeVirtualizationExtensions lets HV01 and HV02 run Hyper-V themselves, and MAC spoofing lets their own VMs reach the network. Open each with vmconnect, finish the short setup and set the same Administrator password on all three.

✅ Checkpoint: HVDC, HV01 and HV02 are Running and each has its own small .vhdx based on base.vhdx.

3Configure everything with PowerShell Direct

On your laptop, set addresses and build the DC (no network to the VMs needed):

$local = Get-Credential Administrator
$ip = @{ HVDC = '192.168.50.10'; HV01 = '192.168.50.11'; HV02 = '192.168.50.12' }
foreach ($v in $ip.Keys) {
    Invoke-Command -VMName $v -Credential $local -ArgumentList $ip[$v], $v -ScriptBlock {
        param($addr, $name)
        New-NetIPAddress -InterfaceAlias Ethernet -IPAddress $addr -PrefixLength 24 | Out-Null
        Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.50.10
        Rename-Computer -NewName $name -Restart
    }
}
Start-Sleep -Seconds 90
$dsrm = $local.Password
Invoke-Command -VMName HVDC -Credential $local -ScriptBlock {
    Install-WindowsFeature AD-Domain-Services -IncludeManagementTools | Out-Null
    Install-ADDSForest -DomainName hvlab.internal -DomainNetbiosName HVLAB -InstallDns -SafeModeAdministratorPassword $using:dsrm -Force
}

-VMName instead of -ComputerName is PowerShell Direct: the command travels over the VMBus from the host into the VM. The DC restarts after promotion; give it five minutes.

Then join HV01 and HV02 and install Hyper-V on them:

$dom = Get-Credential HVLAB\Administrator
foreach ($v in 'HV01','HV02') {
    Invoke-Command -VMName $v -Credential $local -ScriptBlock {
        Add-Computer -DomainName hvlab.internal -Credential $using:dom
        Install-WindowsFeature Hyper-V -IncludeManagementTools -Restart
    }
}

After they restart (twice), check from your laptop:

Invoke-Command -VMName HV01, HV02 -Credential $dom -ScriptBlock { (Get-WindowsFeature Hyper-V).InstallState; (Get-CimInstance Win32_ComputerSystem).Domain }

You should see something like this:

Installed
hvlab.internal
Installed
hvlab.internal

✅ Checkpoint: HV01 and HV02 are members of hvlab.internal with the Hyper-V role installed.

4Live migrate a running VM

Enable live migration on both hosts, create a test VM on HV01 and start it:

Invoke-Command -VMName HV01, HV02 -Credential $dom -ScriptBlock {
    Enable-VMMigration
    Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos -UseAnyNetworkForMigration $true
}
Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock {
    New-VM -Name Nested01 -Generation 2 -MemoryStartupBytes 512MB -NoVHD | Out-Null
    Start-VM Nested01
    Measure-Command { Move-VM -Name Nested01 -DestinationHost HV02 -IncludeStorage -DestinationStoragePath C:\VMs\Nested01 } | Select-Object TotalSeconds
}
Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock { Get-VM Nested01 | Select-Object Name, State, Uptime }

You should see something like this:

TotalSeconds
------------
     6.4210

Name     State   Uptime
----     -----   ------
Nested01 Running 00:00:41

The VM is now on HV02 and still Running, and its Uptime didn’t reset: it never stopped.

This was a shared-nothing migration: the VM’s files moved too, because HV01 and HV02 share no storage. Running Move-VM on the source host means no Kerberos constrained delegation is needed.

To start migrations from a management machine, you’d configure delegation for the “cifs” and “Microsoft Virtual System Migration Service” services on each host’s computer account.

✅ Checkpoint: Nested01 is Running on HV02 with an uptime longer than the migration time.

Hyper-V live migration lab: Nested01 still running on HV02 after the move
Nested01 moved in about six seconds and its uptime kept counting: it never stopped.

5Set up Hyper-V Replica and run a test failover

Make HV02 a Replica server, then replicate a new VM from HV01:

Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock {
    Set-VMReplicationServer -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $true -DefaultStorageLocation C:\Replica
    Enable-NetFirewallRule -DisplayName 'Hyper-V Replica HTTP Listener (TCP-In)'
}
Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock {
    New-Item -ItemType Directory C:\VMs -Force | Out-Null
    New-VM -Name Nested02 -Generation 2 -MemoryStartupBytes 512MB -NewVHDPath C:\VMs\Nested02.vhdx -NewVHDSizeBytes 1GB | Out-Null
    Enable-VMReplication -VMName Nested02 -ReplicaServerName HV02.hvlab.internal -ReplicaServerPort 80 -AuthenticationType Kerberos -ReplicationFrequencySec 300
    Start-VMInitialReplication -VMName Nested02
    Start-Sleep -Seconds 30
    Measure-VMReplication -VMName Nested02 | Select-Object Name, State, Health, PrimaryServer, ReplicaServer
}

You should see something like this:

Name     State       Health PrimaryServer       ReplicaServer
----     -----       ------ -------------       -------------
Nested02 Replicating Normal HV01.hvlab.internal HV02.hvlab.internal

Run a test failover on HV02, check it, then stop it:

Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock {
    Start-VMFailover -VMName Nested02 -AsTest -Confirm:$false
    Get-VM 'Nested02 - Test' | Select-Object Name, State
    Stop-VMFailover -VMName Nested02
}

You should see something like this:

Name            State
----            -----
Nested02 - Test Off

A test failover creates a separate copy (“Nested02 – Test”) from the latest recovery point, which you can start on an isolated network to prove recovery works, while replication from HV01 carries on. Real DR plans include a test like this every few months.

✅ Checkpoint: Nested02 replicates with Health Normal, and the test failover VM appeared and was removed.

Break It, Then Fix It

Two failures that stop maintenance windows: a migration that can’t find what it needs on the other host, and replication that can’t reach its partner.

1Break it: a switch that only exists on one host

Create a switch on HV01 only, connect a new VM to it and try to migrate:

Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock {
    New-VMSwitch -Name AppNet -SwitchType Private | Out-Null
    New-VM -Name Nested03 -Generation 2 -MemoryStartupBytes 512MB -NoVHD -SwitchName AppNet | Out-Null
    Start-VM Nested03
    Move-VM -Name Nested03 -DestinationHost HV02 -IncludeStorage -DestinationStoragePath C:\VMs\Nested03
}

You’ll get an error like this:

Move-VM : Virtual machine migration operation for 'Nested03' failed at migration destination 'HV02'. (Virtual
machine ID 6F2A...)
The virtual machine 'Nested03' is not compatible with physical computer 'HV02'. (Virtual machine ID 6F2A...)
Could not find Ethernet switch 'AppNet'.
    + CategoryInfo          : InvalidOperation: (:) [Move-VM], VirtualizationException
    + FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.MoveVM

The VM is still running happily on HV01; nothing broke except the move. Before any migration, Hyper-V checks the destination can run the VM: switch names, CPU features, memory, storage paths. You can run that check without moving anything with Compare-VM.

Fix it: create the same switch on HV02 (switch names must match on every host), then migrate:

Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock { New-VMSwitch -Name AppNet -SwitchType Private | Out-Null }
Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock { Move-VM -Name Nested03 -DestinationHost HV02 -IncludeStorage -DestinationStoragePath C:\VMs\Nested03 }

✅ Checkpoint: The move failed with “Could not find Ethernet switch” and succeeded after creating AppNet on HV02.

Hyper-V live migration lab: Could not find Ethernet switch error
The compatibility check stops the move because HV02 has no AppNet switch; the VM keeps running on HV01.

2Break it: Replica server behind a closed firewall

On HV02, close the Replica listener rule, then make HV01 replicate now:

Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock { Disable-NetFirewallRule -DisplayName 'Hyper-V Replica HTTP Listener (TCP-In)' }
Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock {
    Start-Sleep -Seconds 330
    Measure-VMReplication -VMName Nested02 | Select-Object Name, State, Health
    (Get-VMReplication -VMName Nested02 | Measure-VMReplication).LastReplicationTime
}

You’ll see something like this:

Name     State       Health
----     -----       ------
Nested02 Replicating Warning
19/10/2026 22:41:07

Health turns to Warning and then Critical as missed cycles pile up, and the Hyper-V-VMMS Admin log on HV01 reports that it can’t connect to the Replica server on port 80. Your recovery point is getting older every minute, and nobody notices unless they monitor replication health.

Fix it: open the rule and let replication catch up:

Invoke-Command -VMName HV02 -Credential $dom -ScriptBlock { Enable-NetFirewallRule -DisplayName 'Hyper-V Replica HTTP Listener (TCP-In)' }
Invoke-Command -VMName HV01 -Credential $dom -ScriptBlock { Resume-VMReplication -VMName Nested02 -Resynchronize -ErrorAction SilentlyContinue; Start-Sleep 60; Measure-VMReplication -VMName Nested02 | Select-Object Health }

✅ Checkpoint: Replica health went to Warning while port 80 was blocked and back to Normal after the fix.

This happened at work

The ISO that blocked host maintenance

A team had a four-hour window to patch a three-node Hyper-V cluster. The plan was simple: drain each node with live migration, patch, restart, repeat.

On the first node, eleven VMs moved and four refused. Each had an ISO file attached from the node’s own C: drive, left behind months earlier after installing software. The other nodes couldn’t see that path, so the migration checks failed.

Two of the VMs also had a checkpoint stored on local disk.

Removing the ISOs was easy. The checkpoints needed merging first, which took most of an hour, and the window ran out before the third node was patched.

The fix: a pre-maintenance script now lists VMs with ISOs attached, local paths, old checkpoints and mismatched switches, using Compare-VM against another node. Admins fix those the day before.

The lesson: live migration only works if everything a VM uses exists on the destination. Check before the window, not during it.

Common mistakes and troubleshooting

Mistake or symptomWhat happensWhat to do instead
“Could not find Ethernet switch”The destination lacks a switch with the same nameIdentical switch names on every host
ISO or files on a host’s local driveMigration checks failEject ISOs; keep VM files on shared or included storage
Different CPU generationsVMs refuse to migrateProcessor compatibility mode, or matching hosts
Remote Move-VM fails with KerberosConstrained delegation isn’t setConfigure delegation for cifs and the migration service, or run on the source host
Live migration on the VM networkUsers feel the copy trafficA dedicated migration network or SMB Direct
Replica health Warning/Critical unnoticedRecovery points get oldMonitor Measure-VMReplication and VMMS logs
Never testing failoverDR fails when you need itRegular test failovers
Treating Replica as backupCorruption replicates tooBackups with history as well (Lesson 38)
Cloning VMs without SysprepDuplicate SIDs and authentication failuresSysprep a base disk, then use differencing or copies

Interview questions

Click a question to open it. Under each one you’ll find what the interviewer is really looking for, and one good way to answer.

Fresher level

1. What is live migration?

What they’re really checking: Do you know the concept?

How you could answer: Moving a running VM between Hyper-V hosts with no noticeable downtime by copying its memory while it runs.

2. What is Hyper-V Replica?

What they’re really checking: Do you know DR basics?

How you could answer: Asynchronous replication of a VM to another host every 30 seconds, 5 or 15 minutes, so you can fail over if the primary site is lost.

3. What is PowerShell Direct?

What they’re really checking: Have you used it?

How you could answer: Running PowerShell inside a VM from its Hyper-V host with Invoke-Command -VMName or Enter-PSSession -VMName, over the VMBus, without network access.

2–5 years experience

4. What is the difference between live migration in a cluster and shared-nothing live migration?

What they’re really checking: Do you know the types?

How you could answer: In a cluster, storage is shared so only memory and state move. Shared-nothing moves memory and the VM’s disks between hosts with no shared storage.

5. Why might a live migration fail?

What they’re really checking: Can you list real causes?

How you could answer: Different CPU features, missing switch names, local ISOs or paths, insufficient memory on the destination, network or authentication problems, or Kerberos delegation missing for remote initiation.

6. Explain planned, unplanned and test failover in Replica.

What they’re really checking: Do you understand DR operations?

How you could answer: Planned: shut down the primary, send the last changes, fail over with no data loss. Unplanned: primary is lost, start the replica from the latest recovery point. Test: start a copy on an isolated network without affecting replication.

Senior level

7. Design DR for 50 VMs between two sites.

What they’re really checking: Do you think about RPO and RTO?

How you could answer: Classify VMs by RPO/RTO, use Replica or Storage Replica or backup-based DR accordingly, plan networks and IPs at the DR site, document runbooks, automate failover order, and test failovers regularly.

8. How would you speed up live migrations of large VMs?

What they’re really checking: Do you know performance options?

How you could answer: Dedicated 10/25 Gb networks, SMB Direct with RDMA, compression on slower links, enough parallel migrations, and reducing memory churn during the move.

9. What do AVMA and GPU partitioning give you?

What they’re really checking: Are you current with Hyper-V features?

How you could answer: AVMA activates Windows Server guests on an activated Datacenter host without KMS or keys per VM. GPU partitioning shares one physical GPU between VMs, and Server 2025 supports live migration of GPU-P VMs.

Quick quiz

Q1. What does live migration copy while the VM runs?

  1. Only the disk
  2. The VM’s memory, then the changes
  3. Nothing
Show answer

B — Final state is sent in a brief pause.

Q2. Which command runs PowerShell inside a VM from its host with no network?

  1. Invoke-Command -ComputerName
  2. Invoke-Command -VMName
  3. Enter-PSSession -Port
Show answer

B — That’s PowerShell Direct.

Q3. Why did Nested03 fail to migrate?

  1. Not enough memory
  2. The AppNet switch didn’t exist on HV02
  3. Wrong password
Show answer

B — Switch names must match.

Q4. What does a Replica test failover do?

  1. Shuts down the primary
  2. Starts a separate copy without stopping replication
  3. Deletes recovery points
Show answer

B — It proves recovery works.

Q5. In the work story, what blocked migrations?

  1. A virus
  2. ISOs attached from local drives
  3. A power cut
Show answer

B — Check with Compare-VM beforehand.

Quick recap

  • Hyper-V live migration moves running VMs by copying memory in passes, with a pause under a second.
  • Shared-nothing migration moves disks too; clusters only move memory.
  • Hosts need matching switch names, compatible CPUs and reachable storage; check with Compare-VM.
  • Hyper-V Replica keeps a copy minutes behind for disasters; test failovers regularly.
  • PowerShell Direct manages VMs from the host without a network.
  • Sysprep before cloning; AVMA and GPU-P round out Hyper-V on Server 2025.

Next lesson

Lesson 30: Windows Server containers → You’ll install a container runtime on Server 2025, pull a Windows Server Core image, run and inspect a container, build your own image with a Dockerfile, and compare process and Hyper-V isolation.

Further reading: Hyper-V live migration

Want to go deeper into Hyper-V live migration? Microsoft’s Hyper-V Replica guide explains replication and failover, and the live migration with workgroup clusters page shows what Server 2025 adds for migration. You can also see the full plan for this course on the Windows Server Administration course page.

Scroll to Top