OVF Tool – Encoding special characters

I recently had to export multiple VMs to OVF templates. To simplify the process, I decided to use the OVFTool. However, I ran into an error: “Cannot parse locator.”
Luckily with a quick search I’ve found William’s post and it saved my day. (Again)
Inspired by William’s post, I decided to break down the command and test whether I could at least establish a connection to the ESXi host.

To start, my command looked like this:

.\ovftool.exe vi://root:ESXi_Password@ESXi_FQDN:443/"VM_name" "Path.ovf"

To troubleshoot, I tested a simpler version:

.\ovftool.exe vi://root:ESXi_Password@ESXi_FQDN:443

Same issue. At this point, I began checking whether my password contained special characters—and it did!

Like William’s post says: The use of the forward slash (/) character is an issue as that that is a delimiter for the OVFTool connection string and both the back slash (\) and number sign (#) also special characters that will cause parsing errors.

I have used this URL encoding reference to simply encode the special characters into the following:

My password:
SecurePasswordaCq3A%LS/

Special character from my password:
/ => %2F
encoded (/) to (%2F)

And password now looking like this:
SecurePasswordaCq3A%LS%2F

After using the “encoded password” the command completed successfully.

Another great article by Andrew Dauncey worth reading.

I hope my post, along with William’s and Andrew’s, helps you and others just as theirs helped me. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *