Import and Export Virtual Machines from the command line with VMware's OVF Tool
Importing Virual Machines (also called deploying OVF templates) or exporting them into the OVF format can be done with the vSphere Client, vSphere Web Client or from the vCloud Director management portal. But did you know you can also perform these actions from the command line? There is a utility available from VMware that runs on Linux and Windows that allows you to perform these actions from the command line, and thus can also be used in scripts.
When you download the Windows-version it installs from a .MSI file. The setup wizard installs the tool into c:\program files\vmware\vmware ovf tool by default. And after the installation it's all command line access. Start with ovftool.exe --help to checkout the syntax or access the documentation for the syntax and examples.
Here is an example of importing the vCenter Linux Appliance to an ESXi-host. Very useful when you have your first ESXi-server installed and want to import that appliance and don't want to use the vSphere Client or you are running Linux.
This is the basic syntax for the import into ESXi:
ovftool /ovfs/my_vapp.ovf vi://username:pass@my_esx_host
And here is a real life example:
In this example I have added the parameters to disable SSL-certificate checking and verification and the name of a datastore and network for the virtual appliance.
ovftool --disableVerification --noSSLVerify --datastore=NFS01 --network="VM Network" VMware-vCenter-Server-Appliance-126.96.36.19901-1476389_OVF10.ova vi://firstname.lastname@example.org