Hyper-V live migration and Hyper-V Replica
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Core administration and security
-
Phase 3: Enterprise infrastructure
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
On a real Hyper-V host you can’t simply reboot for patches, because 20 VMs would go down with it. Hyper-V live migration moves running VMs to another host with no downtime, Hyper-V Replica keeps a copy ready at a second site, and between them they’re the reason admins can do host maintenance in the middle of the working day.
You’ll build a small nested lab inside your laptop’s Hyper-V (a DC and two Hyper-V hosts), live migrate a running VM from one host to the other, set up Hyper-V Replica and run a test failover. Along the way you’ll also meet AVMA and GPU partitioning.
| Time | You need | By the end you can |
|---|---|---|
| About 2 hours | Hyper-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. The movers copy each room to the new house while people are still using it, then copy what changed, then the little bit that changed after that, and in the last second the family steps through a door into the new house where everything is already waiting. Live migration does this with a VM’s memory: copy, copy the changes, copy the last bit, switch over. Hyper-V Replica is a different idea. It keeps a spare copy of the house in another town, a few minutes behind, in case the first one burns down, so one is for maintenance on a running VM and the other is for disasters.
Engineer's View
Live migration, Replica, AVMA, GPU-P
Live migration: while the VM runs, the source copies its memory pages to the destination over TCP 6600 and then repeats the copy for pages that changed. Finally it pauses the VM for a moment, sends the last state and resumes the VM on the destination. Compression is the default, and SMB Direct is an option for speed. The 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 the memory moves, while shared-nothing live migration moves both memory and disks between standalone hosts. Authentication is either Kerberos (domain hosts, with constrained delegation if you start the move remotely) or CredSSP.
Hyper-V Replica copies a VM’s disk changes to another host asynchronously 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 built for disaster recovery, so don’t expect zero downtime from it.
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
Here are the three passes of a live migration:
The pause at the end is usually well under a second, which is short enough for TCP connections and RDP sessions to survive. The busier the VM’s memory is, the more passes the migration needs.
Here’s the nested lab you’ll build on your laptop:
- Base disk: install Server Core once, sysprep it, and use it as a read-only parent.
- Three VMs on differencing disks: HVDC (DC for hvlab.internal), HV01 and HV02 (nested Hyper-V hosts).
- Configure them with PowerShell Direct: addresses, domain, Hyper-V role.
- Live migrate a running VM from HV01 to HV02.
- 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 still counts as running and migrates the same way as one with Windows.
Hands-on Lab: Hyper-V live migration in a nested lab
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
Work on your laptop in PowerShell as administrator with the hypervisor turned on (Lesson 28, step 6), and shut down your VirtualBox VMs to free up memory.
1Build a sysprepped base disk
Create a VM, install Server Core in it and 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 BASEInstall 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 $trueSysprep gives every copy a new machine SID, which avoids the duplicate-SID failures from the work story in Lesson 13. The parent disk must never change again, which is why you make it 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, MemoryAssignedYou should see something like this:
Name State MemoryAssigned
---- ----- --------------
HVDC Running 1610612736
HV01 Running 3221225472
HV02 Running 3221225472Each differencing disk starts almost empty and holds only that VM’s changes. ExposeVirtualizationExtensions lets HV01 and HV02 run Hyper-V themselves, and MAC spoofing lets their own VMs get onto the network. Open each VM with vmconnect, finish the short setup and give all three the same Administrator password.
✅ 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 the addresses and build the DC (you don’t need any network to the VMs for this):
$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
}Using -VMName instead of -ComputerName is what makes it PowerShell Direct, because the command travels from the host into the VM over the VMBus. The DC restarts after promotion, so give it five minutes.
Next, join HV01 and HV02 to the domain 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
}
}Once they’ve restarted (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:41The VM is now on HV02 and still Running, and its Uptime didn’t reset, because it never stopped.
This was a shared-nothing migration, so the VM’s files moved as well, since HV01 and HV02 share no storage. Because you ran Move-VM on the source host, you didn’t need Kerberos constrained delegation.
If you want to start migrations from a management machine instead, you’d set up 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.

5Set up Hyper-V Replica and run a test failover
Make HV02 a Replica server, then replicate a new VM to it 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.internalRun a test failover on HV02, check it and 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 OffA test failover creates a separate copy (“Nested02 – Test”) from the latest recovery point. You can start it on an isolated network to prove recovery works, and replication from HV01 keeps going the whole time. A proper DR plan includes 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
These two failures can wreck a maintenance window: 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 it:
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.MoveVMThe VM is still running happily on HV01, and the only thing that failed is the move. Before any migration Hyper-V checks that the destination can run the VM, looking at switch names, CPU features, memory and storage paths, and you can run the same check without moving anything by using Compare-VM.
Fix it: create the same switch on HV02 (every host needs matching switch names) and migrate again:
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.

2Break it: Replica server behind a closed firewall
On HV02, close the Replica listener rule, then tell HV01 to replicate straight away:
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:07As missed cycles pile up, health goes to Warning and then Critical, and the Hyper-V-VMMS Admin log on HV01 says it can’t connect to the Replica server on port 80. Meanwhile your recovery point gets older every minute, and nobody notices unless someone is monitoring 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, and the plan looked simple: drain each node with live migration, patch it, restart it, move on to the next. On the first node eleven VMs moved and four refused. Each of the four had an ISO file attached from the node’s own C: drive, left there months earlier after a software install, and because the other nodes couldn’t see that path the migration checks failed. Two of those VMs also had a checkpoint stored on local disk. Ejecting the ISOs took no time, but the checkpoints had to be merged first, which ate most of an hour, and the window closed before the third node was patched.
The fix: a pre-maintenance script now runs Compare-VM against another node and lists VMs with ISOs attached, local paths, old checkpoints and mismatched switches, and the admins fix those the day before.
The lesson: live migration only works if everything a VM uses also exists on the destination, so check before the window starts rather than in the middle of it.
Common mistakes and troubleshooting
| Mistake or symptom | What happens | What to do instead |
|---|---|---|
| “Could not find Ethernet switch” | The destination lacks a switch with the same name | Identical switch names on every host |
| ISO or files on a host’s local drive | Migration checks fail | Eject ISOs; keep VM files on shared or included storage |
| Different CPU generations | VMs refuse to migrate | Processor compatibility mode, or matching hosts |
| Remote Move-VM fails with Kerberos | Constrained delegation isn’t set | Configure delegation for cifs and the migration service, or run on the source host |
| Live migration on the VM network | Users feel the copy traffic | A dedicated migration network or SMB Direct |
| Replica health Warning/Critical unnoticed | Recovery points get old | Monitor Measure-VMReplication and VMMS logs |
| Never testing failover | DR fails when you need it | Regular test failovers |
| Treating Replica as backup | Corruption replicates too | Backups with history as well (Lesson 38) |
| Cloning VMs without Sysprep | Duplicate SIDs and authentication failures | Sysprep a base disk, then use differencing or copies |
Interview questions
Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. Can you explain in simple words what live migration is?
Why they ask this: They’re checking you understand the idea and why it matters for keeping services running.
How you might answer: Live migration moves a running VM from one Hyper-V host to another without any downtime users would notice. It copies the VM’s memory to the new host while the VM keeps running and switches over at the end.
2. Your manager asks what Hyper-V Replica gives us if the main site goes down. How would you explain it?
Why they ask this: They want to see that you know the disaster recovery basics and the replication intervals.
How you might answer: Hyper-V Replica keeps an asynchronous copy of a VM on another host, updated every 30 seconds, 5 minutes or 15 minutes. If we lose the primary site, we fail over and start the replica copy on the other host.
3. A VM’s network is broken and you can’t RDP to it. How could you still run PowerShell inside it?
Why they ask this: They want to know if you’ve used PowerShell Direct, which saves a lot of time in this exact situation.
How you might answer: I’d use PowerShell Direct from the Hyper-V host, with Enter-PSSession -VMName or Invoke-Command -VMName. It goes over the VMBus, so it doesn’t need any network access to the VM.
2–5 years experience
4. What’s the difference between live migration inside a cluster and shared-nothing live migration?
Why they ask this: They want to see you know both types and what moves in each case.
How you might answer: In a cluster the storage is shared, so only the VM’s memory and state move. With shared-nothing there’s no shared storage, so the memory and the VM’s disks both travel between the hosts.
5. You start a live migration and it fails. What are the usual reasons?
Why they ask this: They’re checking you can name real causes from experience, not only say “check the logs”.
How you might answer: The usual ones are different CPU features between hosts, a virtual switch name missing on the destination, a local ISO or path attached to the VM, or not enough memory on the destination. It can also be a network or authentication problem, or missing Kerberos delegation when you start the move remotely.
6. Walk me through the difference between a planned, an unplanned and a test failover in Hyper-V Replica.
Why they ask this: They want to see you understand DR operations and know when to use each type.
How you might answer: In a planned failover I shut down the primary, send the last changes and fail over with no data loss. An unplanned failover is when the primary is already gone, so I start the replica from the latest recovery point. A test failover starts a copy on an isolated network, which lets me test DR without touching replication.
Senior level
7. You’re asked to design disaster recovery for 50 VMs between two sites. How would you approach it?
Why they ask this: They want to see you think in RPO and RTO and plan the whole process, not only the replication.
How you might answer: I’d sit with the business first and classify the VMs by RPO and RTO, and then pick Hyper-V Replica, Storage Replica or backup-based DR for each group. After that I’d plan the networks and IPs at the DR site, write runbooks, automate the order the VMs start in and test failovers regularly.
8. Live migrations of your big VMs take far too long. How would you speed them up?
Why they ask this: They want to check that you know the performance options for live migration.
How you might answer: I’d give live migration its own 10 or 25 Gb networks and use SMB Direct with RDMA where we can, with compression on slower links. I’d also set a sensible number of parallel migrations and try to cut down memory churn on the VM while it moves.
9. What do AVMA and GPU partitioning give you on Hyper-V, and when would you use them?
Why they ask this: They want to see you’re up to date with the Hyper-V features that save cost and effort.
How you might answer: AVMA activates Windows Server guests on an activated Datacenter host without KMS or a key per VM, which makes activation easy when you have lots of VMs. GPU partitioning shares one physical GPU between several VMs, and Server 2025 can live migrate GPU-P VMs.
Quick quiz
Q1. What does live migration copy while the VM runs?
- Only the disk
- The VM’s memory, then the changes
- 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?
- Invoke-Command -ComputerName
- Invoke-Command -VMName
- Enter-PSSession -Port
Show answer
B — That’s PowerShell Direct.
Q3. Why did Nested03 fail to migrate?
- Not enough memory
- The AppNet switch didn’t exist on HV02
- Wrong password
Show answer
B — Switch names must match.
Q4. What does a Replica test failover do?
- Shuts down the primary
- Starts a separate copy without stopping replication
- Deletes recovery points
Show answer
B — It proves recovery works.
Q5. In the work story, what blocked migrations?
- A virus
- ISOs attached from local drives
- 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 the disks too, while in a cluster only the memory moves.
- Hosts need matching switch names, compatible CPUs and reachable storage; check with
Compare-VM. - Hyper-V Replica keeps a copy a few minutes behind for disasters, so test failovers regularly.
- PowerShell Direct manages VMs from the host without a network.
- Sysprep before you clone, and AVMA and GPU-P round out Hyper-V on Server 2025.
Next lesson
Lesson 30: Windows Server containers → Next you’ll install a container runtime on Server 2025, pull a Windows Server Core image, run and inspect a container, build your own image from 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.
