Moving (copying) a VM between standalone ESX hosts. – using ovftool

Download ovftool from VMware (https://my.vmware.com/group/vmware/get-download?downloadGroup=OVFTOOL430UPDATE3)

For example copy a machine called jetfun from host – esxhost1 to esxhost2 – replace the new with the new hosts “vm network”
overwrite any machine with the same name there
place the new machine on datastore1
provision as a thin disk

.\ovftool  -dm=thin  -nw="VM Network" --overwrite  -ds=datastore1 vi://root@esxhost1/jetfun vi://root@esxhost2

You will be prompted for the passwords for the hosts, source and then target.

Output

Enter login information for source vi://192.168.4.200/
Username: root
Password: ****************
Opening VI source: vi://root@192.168.4.200:443/jetfun
Opening VI source: vi://root@192.168.4.200:443/jetfun
Enter login information for target vi://192.168.4.201/
Username: root
Password: ********
Opening VI target: vi://root@192.168.4.201:443/
Deleting VM: jetfun
Deploying to VI: vi://root@192.168.4.201:443/
Disk Progress: 1%

If the hardware versions dont match you get an error like

unsupported hardware family 'vmx-14'

that means you are trying to copy from a newer version of esx to and older one. 

easy fix is to add the switch

--maxVirtualHardwareVersion=10

with the appropriate version number and the VM will be converted to the older version compatibility. You might need to Upgrade it once it is in the new server.

also worth noting that the source or destination can be local disk folder and the seperare files ovf, vmdk, iso, nvram and mf will be created or read in the subfolder.


About Jeff Turner

Technical director of Nano Tera Network Solutions.
This entry was posted in Powershell, VBS, VBA and other scripting., System Administration and tagged . Bookmark the permalink.