WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Quick Tip - Encoding special characters for OVFTool on the command-line

Quick Tip - Encoding special characters for OVFTool on the command-line

12.12.2022 by William Lam // Leave a Comment

If you use strong and complex passwords that contain special characters (which you should), it can some times be challenging from an automation perspective on how to properly escape these characters, which can also depend on the scripting or programming language that you are using.

Today I learned about a nice little enhancement in OVFTool 4.4 or later, which makes it easy to handle complex passwords containing special characters by supporting URL encoding for these characters. This is also great for those writing automation scripts and not having to input the password interactively but can now be added to OVFTool command-line string.

As an example, lets take the following password: #/MySuperSecretPassword\# which is valid for ESXi, but is problematic for a few reason. 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.

Using this URL encoding reference, we simply encode these special characters into the following:

  • # 👉 %23
  • / 👉 %2F
  • \ 👉 %5C

and we now end up with the following password string: %23%2FMySuperSecretPassword%5C%23

Once we properly encode these special characters, we can now pass our password directly or in-directly through the use of a variable on the command-line to OVFTool:

ovftool "vi://root:#/MySuperSecretPassword\#@192.168.30.120"

More from my site

  • Quick Tip - Easily move or copy VMs between two Free ESXi hosts?
  • Quick Tip - How to deploy OVF/OVA to multiple networks using OVFTool?
  • OVFTool 4.4.1 - Upload OVF/OVA from URL using upcoming "pull" mechanism
  • NSX-T Edge OVF property to automatically join NSX-T Management Plane
  • Really cool updates with OVFTool 4.4 and support for vSphere 7

Categories // Automation, OVFTool Tags // ovftool

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • Automated ESXi Installation with a USB Network Adapter using Kickstart 02/01/2023
  • How to bootstrap ESXi compute only node and connect to vSAN HCI Mesh? 01/31/2023
  • Quick Tip - Easily move or copy VMs between two Free ESXi hosts? 01/30/2023
  • vSphere with Tanzu using Intel Arc GPU 01/26/2023
  • Quick Tip - Automating allowed and not allowed Datastores for use with vSphere Cluster Services (vCLS) 01/25/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...