Transporting Custom VM Fields Between vCenter Servers
One of my customers recently migrated a bunch of VMs between two vCenter servers . When they finished, they realized that none of their VMs' custom attributes followed the VMs into the new vCenter environment; apparently those attributes are owned by the vCenter server, rather than stored in the VMX file. Fortunately, they had an export of their VM inventory that included those custom fields, but they had no idea how to repopulate that data across their horde of VMs. You can see where this is going... and, as expected, I helped them put together a quick PowerCLI script that would set things straight. This script takes 2 parameters as input: a CSV file that contains the data from the VM inventory (including each VM Name and columns for each of the custom attributes), and an array of which custom attributes need to be set (since that inventory export file is probably going to contain a lot of columns that aren't custom attributes). Once it's executed, the script goes