Recently is had some issues with capacity and old server hardware. I created some new ESXi hosts and wanted to move the VMs to the new hosts. Below i will describe how i obtained this:
Start SSH and ESXi Shell on both servers, you can do this from the Web UI, Hosts > Actions > Services
Now create the destination folder (mostly VM name) on the new ESXi host.
You must create the folder on the destination datastore before performing the copy
Connect with SSH to the source ESXi host.
Check if you have shutdown the VM you are going to copy!
Enable SSH client (CLI method).
Check if SSH client service is enabled. Will return ‘False’ if ‘Disabled’.
esxcli network firewall ruleset list --ruleset-id sshClient
Then enable SSH client.
esxcli network firewall ruleset set --ruleset-id sshClient --enabled=true
Copying the VM
Go to the to the VM directory:
scp -v -c aes128-ctr -r * email@example.com:/vmfs/volumes/datastore1/VMNAME
This will (if it connects properly) prompt for the root password.
Once connected it will display progress ETA and speed.
Parameter -C is not required but is sometimes helpful to speed up transfers. -c parameter encrypts the data and compresses it in transition.