Powershell Script to live migrate all running VMs; including storage; from one host to another. Enter the source and destination host names (or IPs) in lines 4 and 5. Enter the drive letters of the destination host where you wish to live migrate the source host VMs to in line 6.
You can download this script from the Microsoft TechNet Gallery.
The script live migrates the VMs:
It also leaves 2 files on the folder where it runs:
– A log file that shows different information about the source and destination hosts, and the VMs being migrated.
– A CSV file that shows one record per migrated VM listing the source path of each of its disks. This may be useful for failback..
One of the really nice features of Hyper-V is the ability to live-migrate virtual machines from one physical Hyper-V host to another while the VM is running. VMWare calls this feature vMotion. VMware’s vMotion was a bit ahead of Microsoft’s live-Migration until the release of Server 2012 and now 2012 R2. In my opinion Live Migration leaves nothing to be desired and has exceeded many features in vMotion (compared to ESXi 5.5). The script can be downloaded from the Microsoft TechNet Gallery.
Live migration has few requirements including:
- Active Directory domain: all Hyper-V hosts must be in an AD domain (either same domain or domains with two-way trust relationships)
- Kerberos Constrained Delegation
See this Technet article for more details.
KDC can be setup manually in AD Administrative Center. In an environment with a large number of Hyper-V hosts this can get tedious. The following script automates the task of setting KDC between a group of HyperV Servers.
Confirm changes by looking up Host properties in AD Administrative Center: