WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple

How to Deploy an OVF Located On ESXi Datastore Using ovftool

03.11.2012 by William Lam // 43 Comments

I have written several articles in the past about the awesome ovftool which is a versatile remote command-line utility for importing/exporting virtual machines in the OVF format across various VMware products. I mainly run ovftool in either the vMA or on my OSX desktop. When performing an import, the OVF files are local on the same system that has the ovftool installed.

I recently came across an interesting question about using the ovftool to deploy OVF files that are located on an ESXi datastore. My initial thought was that you would not be able to deploy the OVF files since the ovftool would not have access to the files locally. After finishing a recent article about ESXi datastore management using the vCLI's vifs utility, I then realized there might actually be a way to deploy OVF files that are stored on an ESXi datastore.

If you take a look on page 17 of the ovftool user guide, there is a table describing the various source locators that are supported. You can see that the source of an OVF file can be accessed by ovftool in 4 different methods including HTTP/HTTPs which is a key for this specific request.

Source Type Default File Extension Protocol
OVF .ovf File, HTTP, HTTPS, FTP
OVA .ova File, HTTP, HTTPS, FTP
VMX .vmx File
vvApprun N/A File
vCloud Director N/A HTTPS
vSphere N/A vSphere

Files and folders management for a datastore is exposed through the fileManager in the vSphere API and datastores are referenced as a URL or remote path.

A URL has the form

scheme://authority/folder/path?dcPath=dcPath&dsName=dsName

where

  • scheme is http or https.
  • authority specifies the hostname or IP address of the Center or ESX(i) server and optionally the port.
  • dcPath is the inventory path to the Datacenter containing the Datastore.
  • dsName is the name of the Datastore.
  • path is a slash-delimited path from the root of the datastore.

Putting all this together, you can use the ovftool remotely to deploy an OVF file that is stored on an ESX(i) datastore. Below is an example walk through of this process.

Here is an OVF that is stored on a datastore located on an ESXi host:

To identify the URL path to your OVF, you can use a web browser to assist. Point your browser to the following address: https://[ESXI_HOST]/folder

When you first login, you will be brought to the root datacenter, in the case of directly connecting to an ESX(i) host, you will only see "ha-datacenter". Go ahead and select it and then you will be brought to a list of datastores the host has access to.

Select the datastore which contains the OVF file you wish to deploy from and then browse to the specific file.

Make a note of the URL path used to get to the OVF file and the OVF filename itself. Taking the example above, we end up with the following URL path:

https://vesxi50-4.primp-industries.com/folder/MyVM/MyVM.ovf?dcPath=ha-datacenter&dsName=iSCSI-1

To confirm the URL path, we can use ovftool to perform a simple "probe" on our OVF, this will provide you with a quick summary of the OVF.

Next we are ready to import the OVF file to our ESXi host. In this example, we will deploy the OVF to another datastore the ESXi host has access to and configure a specific portgroup to connect to the VM to after deployment. There are various options that can be passed to ovftool, please refer to the ovftool user guide for more details.

One the import has completed, you should now see the VM automatically registered in your ESXi host inventory.

You can see that this method allows you to import an OVF file stored on a datastore locally to the ESXi host as well as an OVF file stored on a remote datastore of another ESXi host. To help manage and deploy your OVF files, you should consider storing them on a centralized "media" datastore or even a WEB/FTP server that can be accessed by the ovftool.

Categories // Automation, OVFTool Tags // ova, ovf, ovftool

Win a Free Automating vSphere with vCenter Orchestrator Book

03.10.2012 by William Lam // 22 Comments

Our good friend Cody Bunch has just recently released a new book called Automating vSphere with vCenter Orchestrator (available in Kindle and paper back format) that provides administrators with a complete walk through of installing, configuring and automating your vSphere infrastructure using vCenter Orchestrator. This is a must have book for all vSphere administrators looking to further automate and orchestrate your virtual infrastructure!

I still consider myself a beginner in vCO, but I have found that it has been very easy to create some really cool workflows such as this, this and this and you do not even need to be a developer to start using vCO! I am looking forward to reading Cody's new book.

Both Pearson and Cody Bunch was kind enough to provide me with an additional paper back copy of Automating vSphere with vCenter Orchestrator. Since sharing is caring, I will be giving away this copy to one lucky reader of virtuallyGhetto!

How do you win?

Just leave a comment below with the top 5 things you would like/hope to automate using vCO in your vSphere infrastructure. I will randomly select a winner a week from today. Even if you do not win, you should definitely still grab a copy of Cody's book and learn how easy it is to leverage vCO in your vSphere environment.

Categories // Uncategorized Tags // orchestrator, vCO, vSphere

Datastore File Management using vCLI vifs

03.09.2012 by William Lam // Leave a Comment

There are many useful scripts that are bundled with the VMware vCLI, one such script, that is not very well known is the vifs utility which provides datastore file management. When you right click on a datastore and browse using the vSphere Client, you can create a new folder, download/upload, delete and move files.

Using the vCLI's vifs utility, you can perform the same set of operations via the command-line and behind the scenes it uses the vSphere API fileManager to perform these operations. You can also browse datastore by just having access to a web browser, just point it to the following address: https://[ESXI_HOSTNAME]/folder and you can access the datastores by clicking through the links.

To browse the datastore using vifs, you will need vCLI installed on either a Windows/Linux system or you may use VMware vMA.

To browse a specific datastore for an ESXi host, you will need to first list the available datastores by using the following command: vifs --server [SERVER] --username [USERNAME] --listds

Once you have identified the datastore you are interested in, you will then use the --dir flag to list the contents of the directory and their sub-directories by using the following command: vifs --server [SERVER] --username [USERNAME] --dir '[DATASTORENAME]'

Note: The format of the datastore name must be in brackets '[datastorename]' which is how a datastore path is identified in the vSphere API. To list sub-directories, you will need a space between the datastore name and the directory name and do not forget to quote the parameter

Let's say you would like to download the .vmx configuration file for in the directory, you can use --get flag to by using the following command:

vifs --server [SERVER] --username [USERNAME] --get '[DATASTORENAME] somedir/somefile.vmx'

Note: In the example above, we are downloading the file in the current working directory denoted by the "." (period). If you wish to download it somewhere else or even renaming the file, you will need to specify the full path to the destination


If you wanted to automate the downloading of say all .vmx configuration files, it might be pretty tedious to run through the directory discovery, so here is a quick shell script called getVMVMX.sh that is more user friendly that allows you to easily download all .vmx configurations for a given datastore.

To use the script, you will need vCLI installed on either a Linux system or use VMware vMA and be sure to set the executable permission on the shell script. You will need to specify the credentials to the ESX(i) host and the specific datastore you wish to either "list" or "download" all .vmx configuration files.

Using the --listds flag, you will need to identify the datastore you wish to use. Next you will use the following command to "list" all .vmx configuration file: ./getVMVMX.sh [ESXI_SERVER] [USERNAME] "[PASSWORD]" [DATASTORE] list

To download all .vmx configuration file you will use the following command:

./getVMVMX.sh [ESXI_SERVER] [USERNAME] "[PASSWORD]" [DATASTORE] download [FOLDER]

where FOLDER is a directory that will automatically be created for you to store all .vmx configuration files

Note: You can easily modify the script to add an additional "for loop" at the beginning to automatically download .vmx configurations for all datastores. I will leave that as an exercise for the reader.

So if you ever need to grab a vmware.log file for a specific VM or upload an ISO to datastore, you can do so from the command-line using the vifs utility that is bundled with the vCLI.

Categories // Uncategorized Tags // ESXi 4.1, ESXi 5.0, ESXi 5.0, vcli, vSphere

  • « Previous Page
  • 1
  • …
  • 492
  • 493
  • 494
  • 495
  • 496
  • …
  • 560
  • Next Page »

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

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

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