Extract host information from within a VM Self configuration and OVF Environment

The OVF in vSphere is not just about deployment and packaging. There is also a runtime part, namely the OVF environment. This is a feature that has been around since the early days of vSphere 4.x, if not earlier which provides a mechanism to retrieve some of this information as well as custom properties.

The OVF feature provides users with the capability to pass in any type of metadata information such as application start up parameters, network configuration, password management, etc. directly into the guestOS for flexible guest customization. In this post, i will show how to fetch the runtime properties of the OVF from guest OS.

This is a pretty simple mechanism that stores key/value pairs. These key/value pairs are typically used to tell a process or shell script about the particular environment it is being executed in. OVF properties are typically configured by the deployer of a vApp The OVF runtime environment is only available while the VM is powered.

Assuming that we have a VM already installed the operating system

We need to

  • Define OVF properties on the VM.
  • Write some glue code to access and apply the information inside the VM.

The OVF environment can be transported to the guest in two ways

As a CD-ROM containing the XML document. The CD-ROM is mounted on the guests CD-ROM drive.

Through VMware Tools. The variable guestinfo.ovfEnv contains the XML document.

Steps to Configure vApp Properties

  • Edit your VM and select the Options tab and enable the vApp Options


  • Under the OVF Settings, specify the how you want to access the OVF environment by either VMware Tools or ISO Image transport

  • If you are interested in adding some custom properties, Click on Advance and click properties

  • Create a new Property Keys; Select the Label, Type and other optional fields

  • Create your required number of properties (i created 2 properties here)
  • Click on vApp Option Properties, Type the Values for the properties

  • Click ok

Wait for some seconds; Let the vSphere reconfigure the VM

After the settings have been applied, go back into the OVF Settings for a powered on VM and you now should be able to click on the “View” button which will show you the OVF runtime environment for that particular VM.

 For a vanilla VM, you should see three basic things

  1. The vCenter MoRef of the VM (vApp property is only available with vCenter and not on a standalone ESXi host)
  2. The hypervisor name and version
  3. The network (Portgroup/Distributed Portgroup) the VM is connected to

To retrieve this same information from within the guestOS

VMware Tools

Make sure you installed VMware Tools, to install VMware Tools refer http://blog.asvignesh.in/install-vmware-tool-in-virtual-ubuntu-guest/

Run the following command

Windows: “C:Program FilesVMwareVMware ToolsVMwareService.exe” -cmd “info-get guestinfo.ovfEnv”

Linux: vmware-guestd –cmd ‘info-get guestinfo.ovfEnv’

ISO Image

Mount the CD-ROM in the guestOS and inside you will find the ovf-env.xml file which contains the OVF runtime environment information.

You can find the ISO attached to VM under edit VM

Create a directory to mount the CD-ROM by running the command:

sudo mkdir /mnt/cdrom

Mount the CD-ROM by running the command:

sudo mount /dev/cdrom /mnt/cdrom or sudo mount /dev/sr0 /mnt/cdrom

ls /mnt/cdrom

You can find the xml file under this directory


  1. Hi, I read your blog named “Extract host information from within a VM Self configuration and OVF Environment” like very week. Your story-telling style is awesome, keep it up!

  2. Its such as you learn my mind! You seem to understand so much about this, such as you wrote the book in it or
    something. I feel that you could do with a few % to force the message home a little bit, however instead of that, this is great blog.

    A great read. I’ll certainly be back.

  3. Excellent article. Keep posting such kind of information on your blog.
    Im really impressed by it.
    Hey there, You’ve done an incredible job. I will certainly digg it and
    in my view recommend to my friends. I’m sure they’ll be benefited from this site.

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