Using Ovftool

Ovftool can be pretty awesome, but it can also be very difficult to use. I seem to have a love/hate relationship with it.

Here I will go over some common issues I have with the tool. I've only tested on the Windows version of ovftool.

As of VMware ovftool 4.3.0 (build-14746126), the local configuration file is now working. There's also a --ConfigFile <myfile.cfg> that can be used to specify a configuration file. There's a bug using the .ovftool/.option file as a local configuration file. It's been reported and hopefully will be fixed soon.

Command line options

First up, get friendly with ovftool --help

The target parameter can get complicated, but to deploy to vCenter, use the format:

vi//<username@domain>:<password>@<vCenter FQDN or IP>/<Datacenter name>/host/<cluster name>.

You can omit the password, and it will prompt you for it. vi://administrator@vsphere.local:VMware1!@vc.vmw.one/Datacenter/host/vSAN

Command line options that have multiple values, or spaces in their name need double quotes. ie: --prop:nsx_role="nsx-manager nsx-controller".

If you don't use double quotes, you'll get some seemingly random error such as Error: Unexpected option: --prop:nsx_netmask_0=255.255.255.0

See below for the full working command.

 1c:\lab\ovftool>ovftool --name=nsx-manager --X:injectOvfEnv --X:logFile=ovftool.log --allowExtraConfig --datastore=vsanDatastore --vmFolder=Infrastructure --network="VM Network" --acceptAllEulas --noSSLVerify --diskMode=thin --powerOn --prop:nsx_role="nsx-manager nsx-controller" --prop:nsx_ip_0=172.31.94.51 --prop:nsx_netmask_0=255.255.255.0 --prop:nsx_gateway_0=172.31.94.1 --prop:nsx_dns1_0=172.31.94.8 --prop:nsx_domain_0=vmw.one --prop:nsx_ntp_0=172.31.94.1 --prop:nsx_isSSHEnabled=True --prop:nsx_allowSSHRootLogin=False --prop:nsx_passwd_0=VMware1!VMware1! --prop:nsx_cli_passwd_0=VMware1!VMware1! --prop:nsx_hostname=nsx-manager "C:\lab\nsx-unified-appliance-2.4.0.0.0.12456291.ova" vi://administrator@vsphere.local:VMware1!@vc.vmw.one/Datacenter/host/vSAN
 2
 3Opening OVA source: C:\lab\nsx-unified-appliance-2.4.0.0.0.12456291.ova
 4The manifest does not validate
 5Opening VI target: vi://administrator%40vsphere.local@vc.vmw.one:443/Datacenter/host/vSAN
 6Deploying to VI: vi://administrator%40vsphere.local@vc.vmw.one:443/Datacenter/host/vSAN
 7Transfer Completed
 8Powering on VM: nsx-manager
 9Task Completed
10Completed successfully

Global configuration files

Options on the command line can get quite long and hard to read as you can see. You can store them all in a global configuration file - one per user.

By default, global configuration files are stored %AppData%\VMware\ovftool.cfg

Keep in mind that when using a configuration file, there's no need to include the -- before an option, and you DON'T use double quotes for values with spaces in. ie: prop:nsx_role=nsx-manager nsx-controller

Global Configuration

Local configuration files

Supposedly the same format as the Global Configuration file, but it reads this from the current directory. One thing to note is the documentation and command output say it looks for ".ovftool", but in fact it tries to read ".option".

Part of the hate relationship shows here where taking the Global configuration and putting it into the local configuration didn't work for me. The configuration shows up in the command help, but I just can't get it to deploy successfully.

Again you can test it with ovftool --help config.

Local Configuration

If you have more success, let me know.

There's a bug using the .ovftool/.option file as a local configuration file. It's been reported and hopefully will be fixed soon.

Failed to connect to server

If you're unable to connect and get the following error below when prompted for the password:

1Enter login information for target vi://vc.vmw.one/
2Username: administrator%40vsphere.local
3Password: ************
4Error: Internal error: Failed to connect to server

Or if you include the password on the command line you may get:

1Error: Cannot parse locator: vi://administrator@vsphere.local:Password1$!#@vc.vmw.one/Datacenter/host/vSAN
2Warning:
3 - No manifest entry found for: 'nsx-unified-appliance-2.4.0.1.0.12910842.ovf'.
4 - File is missing from the manifest: 'nsx-unified-appliance-2.4.0.1.0.12910842.ovf'.
5Completed with errors

Check if you're using a complex password with special characters, you may need to url encode them.

For the above example using Password1$!#, you'll to make it Password1%24%21%23, even if you're prompted for the password.

Check for a new version at https://www.vmware.com/support/developer/ovf.

This was tested on version: VMware ovftool 4.3.0 (build-9264255)