Automation · Hyper-V Automation
Migration
Cheat sheet · https://pcornel.dk/topic.php?topic=5716
Answer
Hyper-V migration automation moves VMs between hosts with Move-VM, including storage with -IncludeStorage, and checks compatibility first with Compare-VM.
Remember
- Compare-VM checks compatibility.
- -IncludeStorage moves disks too.
- Live migration must be enabled.
First checks
Move-VM -Name <vm> -DestinationHost <h>— live migrationMove-ClusterVirtualMachineRole -Name <vm> -Node <n> -MigrationType Live— clusteredSuspend-ClusterNode -Name <n> -Drain— evacuate host
Verify in this order
drain → migrate → maintenance → resume
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5716