WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
    • VMware Cloud Foundation 9
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / OVFTool / 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 // 1 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"

Categories // OVFTool Tags // ovftool

Comments

  1. *protectedLuke Huckaba says

    10/16/2023 at 9:12 am

    You can also do this in powershell:

    $password = "#/MySuperSecretPassword\#"
    Add-Type -AssemblyName System.Web
    $encodedPassword = [System.Web.HttpUtility]::UrlEncode($password)

    Now $encodedPassword is %23%2fMySuperSecretPassword%5c%23

    Reply

Thanks for the comment!Cancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Improved Workaround for NSX Edge Deployment & Upgrade to VCF 9.0.2 running AMD Ryzen CPUs 01/20/2026
  • Disable HTTP Range Requests on Synology WebStation, Apache or Nginx 01/14/2026
  • Quick Tip - Correlating VCF Component to Bundle ID/Name 01/08/2026
  • TLS Chain of Trust when using SSL Inspection with VCF Download Tool (VCFDT) 01/07/2026
  • Quick Tip - Reset vCenter Server from previously managed VCF Operations for VCF Single Sign-On (SSO) 01/06/2026

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 © 2026

 

Loading Comments...