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.

The utility works with vCenter and ESXi but also with vCloud Director and even with Fusion and Workstation. You can download the tool from this link and access the documentation here.

VMware OVF tool installation

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.

Example

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:

OVFtool 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-5.5.0.5201-1476389_OVF10.ova vi://root@esxi.yourdomain.com

 

 

Follow us on LinkedIn

  

   

   

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer