Functions to migration VMs to new hosts and datastores. The functions were used for a specific migration and make the requirements below. Wanted to post it so it could be used as a reference or starting point for others.
Script reads a CSV file with virtual machine names, destination host, and [optionally] a destination datastore or datastore cluster. See sample CSV in repo.
- VMs are being migrated within the same vCenter.
- VMs can optionally be moved to a new host only or new host and new datastore.
- Let work for placement was done in advance and used to create a CSV file (unneeded columns will be ignored).
- You must be logged into the correct vCenter (and only that vCenter if there may be name collisions) before running the script.