WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / OVF Runtime Environment

OVF Runtime Environment

06.11.2012 by William Lam // 36 Comments

I recently noticed a trend of questions from various users about extracting specific bits of information such as the version of ESXi that's running or the MoRef ID of the VM, all while within the guestOS. I had already written an article about this topic awhile back called How to extract host information from within a VM? but it seems like there is still a continued interest to easily obtain this information about the underlying vSphere infrastructure from within the guestOS.

I came across another method while researching a different topic which is to use the vApp property of a VM called the OVF runtime 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.

The OVF runtime environment is only available while the VM is powered and it can be accessed from either VMware Tools or from a special ISO that is mounted to the guestOS CD-ROM device. To enable the OVF runtime environment, you just need to perform these two simple steps:

1. Edit your VM and select the Options tab and enable the vApp Options:

2. 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 enabling this using the vSphere API, take a look at the vAppConfig property. You can enable OVF runtime environment on a running VM, but the changes will not go into effect until the VM has been completely powered off and then powered back on, a guestOS reboot will not suffice.

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:

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

To retrieve this same information from within the guestOS you have two options:

VMware Tools

Run the following command:

vmtoolsd --cmd "info-get guestinfo.ovfenv"

Below are two examples for both a Linux and Windows VM:

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.

As I mentioned earlier, you can also create custom key/value properties which can then be accessed by the guestOS VM. If you go to Advanced section and click on the Properties button, you will be able to add your own custom properties. Below is a screenshot of adding three customer properties called: application_owner, startup_option and system_owner just to give you an idea of the possibilities.

The OVF runtime environment does not just stop with vSphere, but it is also available to VMs running in vCloud Director. The only requirement is that vCloud Director VMs has the vApp options enabled at the vSphere layer as noted earlier. Below is a screenshot for a VM that has been imported into vCloud Director from vSphere and you will notice some additional "vCloud Director" specific properties.

Even though the OVF runtime environment makes it easier to retrieve some of these "underlying" infrastructure details, I am still interested in some of the use cases where you would need to know the hypervisor version or MoRef ID from within the guestOS. If you are currently requiring this or other bits of information, please leave a comment about your particular use case.

More from my site

  • How to extract host information from within a VM?
  • Packer reference for building PhotonOS Virtual Appliance using OVF properties 
  • Building your own Virtual Appliances using OVF properties Part 3
  • Building your own Virtual Appliances using OVF properties Part 2
  • Building your own Virtual Appliances using OVF properties Part 1

Categories // Automation, OVFTool, vSphere Tags // guestinfo, ovf, ovfenv, vmtoolsd, vmware tools

Comments

  1. *protectedMike Foley says

    06/11/2012 at 7:16 pm

    Knowing the MoRef ID might help in providing a "uniqueness" to the VM. Say, for example, I need to encrypt something on the VM using a bunch of data within the VM. I want that data to be something that can survive a vMotion. Today, if you use CPU info, its possible vMotion will cause a failure in unlocking the encrypted stuff. Using unique identifiers as part of the generation of the hash used to encrypt can get around that.

    Reply
    • *protectedWilliam says

      06/11/2012 at 7:26 pm

      Thanks for the comment Mike. Though the MoRef may not always be unique, do you think users would rather use their own "internal" identifier and associate that with the VM during deployment which can then be accessed from within the VM?

      Reply
  2. *protectedMike Foley says

    06/11/2012 at 9:21 pm

    Ideally, I'd like to see the unique value or set of values be presented by vCenter to the VM. Something that an app within the VM can query via an API or some other method. If you have thoughts on this, then I'd like to set up a call with one of our guys who works on stuff like this.

    Reply
    • *protectedWilliam says

      06/11/2012 at 10:16 pm

      Mike, this is definitely possible but the "unique" values would be something an end user would need to specify during or after deployment. OOTB, you can get MoRef but that may not always be unique, but you can add other key/value properties to the VM to help identify it (e.g. CMDB, asset tag, etc). Let me know if you want to chat about this further

      Reply
  3. *protectedAnonymous says

    06/12/2012 at 3:06 am

    The VM's UUID might be an option to consider here. The value is found in the uuid.bios parameter in the virtual machine's .vmx file. You can use PowerCLI to extract the value using: Get-VM MyVM | %{(Get-View $_.Id).config.uuid}.

    Another option: http://derek858.blogspot.com/2010/10/making-your-vmware-vm-uuids-unique.html

    Reply
  4. *protectedMichael Yakobi says

    02/24/2013 at 10:18 pm

    Hi,
    I've imported into vCloud a vAPP which is using the "ISO Image" method for access OVF settings.
    When I boot the VM, the ISO image isn't "inserted into CD".
    Any idea what I'm doing wrong?
    Thanks,
    M.

    Reply
    • *protectedWilliam Lam says

      03/01/2013 at 3:54 pm

      Can you confirm in vSphere that the setting has persisted?

      Reply
  5. *protectedAnonymous says

    04/12/2013 at 11:45 am

    Hi,
    Is there any way so that I can enable the ovf setting using any vcloud API?

    Reply
  6. *protectedJohn Decker says

    01/03/2014 at 2:24 pm

    This is a great article. I think people should start thinking about using technology like this because it could be good for the environment. This year I want to start using different technology and products that are better for the environment. Last year I decided to switch power suppliers in my home. After I learned about NA Power I decided to find a supplier that used green gas.

    Reply
  7. *protectedJustin Lute (@oldmanaround) says

    06/26/2014 at 1:49 pm

    William, can you advise on possible ways to modify values in the OVF runtime environment of a machine after it has been created? For example...

    My OVF environment originally had a property, . I want to change that to .

    Some quick Googling makes it appear that there are vCloud APIs which would allow one to do this? What if I have a vSphere/vCenter-only environment?

    Thanks.

    Reply
    • William Lam says

      06/26/2014 at 2:10 pm

      Yes, you can modify the parameters after it's been deployed and you can use vCloud/vSphere API depending on what you're using. The API is actually mentioned in the article 🙂

      Reply
      • *protectedJustin Lute (@oldmanaround) says

        06/26/2014 at 2:58 pm

        Thanks, William! It was right there. Don't know how I missed that. Next time I'll RTFM.

        Reply
  8. *protectedJustin Lute (@oldmanaround) says

    06/26/2014 at 1:51 pm

    [comment engine didn't like that I put actual XML code in here. retyping with generic key/value formatting]

    William, can you advise on possible ways to modify values in the OVF runtime environment of a machine after it has been created? For example“

    My OVF environment originally had a property, example=foo. I want to change that to example=bar.

    Some quick Googling makes it appear that there are vCloud APIs which would allow one to do this? What if I have a vSphere/vCenter-only environment?

    Thanks.

    Reply
  9. *protectedsam says

    02/03/2015 at 5:48 pm

    Hi William,
    If i create OVF from vmware VM having custom properties set using this procedure, is there a way to define values of custom properties when we deploy OVF in HyperV /Citrix Xen?

    Thanks,

    Reply
    • William Lam says

      02/04/2015 at 2:24 am

      Sam,

      Sure, but I can't speak for other Hypervisors on whether they've implemented such capabilities. It's something you'll have to either ask them or test it out yourself

      Reply
      • *protectedsam says

        02/04/2015 at 6:34 am

        Thanks for the response William,
        Could you please advise if OVF runtime environment specified in following DMTF specification (specifically property section) is mandatory for all hypervisors to support or is it optional:

        http://schemas.dmtf.org/ovf/environment/1/dsp8027.xsd

        Reply
        • William Lam says

          02/04/2015 at 1:50 pm

          The OVF runtime is just how VMware has implemented the ability to consume custom OVF properties which a subset are going to be specific to VMware based solutions. If I were to take a guess, you'll probably be able to export/import a VM to OVF to another hypervisor assuming they've implemented the basics but if they have no concept of consuming OVF properties (just key/value pairs) or have not implemented it, then there's a chance it probably may or may not work. Again, it's something you'll just have to try.

          Reply
  10. *protectedAswini says

    03/27/2015 at 6:47 pm

    William, i deployed a ovf file of n1kv in my VC however when i do a write erase and reload the VM, console/ova custom properties comes all the times,how to customize that section so that VM boots up to login console than asking each time the VM console inputs.

    Reply
  11. *protectedmike leahy says

    04/14/2015 at 2:42 pm

    I have created a VM using ovftool and populated a self created ip address value. do you know how to get windows to read this value and add the ip address to the guest os ? latest versions of esxi and windows

    Reply
    • William Lam says

      04/14/2015 at 3:07 pm

      As shown in the blogpost, you'll need to run the vmtools daemon on the guestOS, in this case Windows to pull the OVF env

      Reply
      • *protectedmike leahy says

        04/14/2015 at 3:22 pm

        thanks. I have ran that but it doesn't pull the ip address in. It can read the ovf env but not assigning it to the vm. How would windows know that the ip address given would be an ip address and not a dns address for example . Its simply created as an ip value

        Reply
        • William Lam says

          04/14/2015 at 10:28 pm

          Well first off, make sure it's actually properly set and secondly, the "setting" would have to be done through a custom script you have within the guestOS. There's nothing magically that'll configure the OS, these are just key/value pairs being passed in and something would need to know how to pickup the right variables such as DNS or IP Address based on the variables you've created.

          Reply
          • *protectedmike leahy says

            04/15/2015 at 6:56 am

            yeah that's the missing part. thanks. Any idea on what could be used to do this ? python script maybe ?

  12. *protectedFrank D'Anna says

    08/04/2016 at 7:42 am

    Great blog, William! I have scoured the web looking for the answer to this question and I can't seem to find it. I want to be able to automate the creation of VMware Appliances and I have all that working, but I can't seem to programmatically inject the properties for networking into the OVF. I see how you've done it with the GUI and that all works, but this is not good for automation. VMware's now end-of-life Studio was able to do this but I can't find another CLI tool that does the same. Any advice? Thanks

    Reply
  13. *protectedonoame72 says

    09/28/2016 at 9:19 am

    as far as i got any changes to the VM at runtime needs a power off/on to be reflected in the ovf environment. I have a use case that needs to change the port group name at runtime and it would be great if the ovf would report the new name and respective MAC address without any need to power off/on the VM.
    The strange thing is that in VM settings->vAPP option the ovf env file is updated without any power off/on.
    Any chance to get an update ovf files without power off/on?

    Reply

Trackbacks

  1. The power of OVF Properties | SFlanders.net says:
    06/26/2014 at 1:05 pm

    […] more cool things you can do with OVF see this […]

    Reply
  2. Caveat when deploying Photon Controller Installer (v0.8) OVA to vCenter Server | virtuallyGhetto says:
    04/11/2016 at 7:39 pm

    […] to the bottom of that and check the "VMware Tools" box. This will ensure that the OVF properties (ovfEnv) can be passed down to the guestOS for […]

    Reply
  3. Building your own Virtual Appliances using OVF properties Part 1 says:
    02/01/2019 at 8:44 am

    […] this happens is through the use of VMware Tools being installed within the GuestOS AND enabling the OVF environment transport mechanism for the given VM. Once this is done, we can then access these key/value pairs directly from the […]

    Reply
  4. vSphere 6.7 Instant Clones – Geek's Blog says:
    05/15/2019 at 2:05 am

    […] custom metadata directly into the GuestOS for customization. This is done through the use of guestinfo properties which can be included as part of the Instant Clone creation spec and is then […]

    Reply
  5. Application Discovery in vSphere with VMware Tools 11 says:
    12/22/2019 at 1:12 pm

    […] application processes within a GuestOS. Once enabled, this information is then published into new VM guestinfo property called guestinfo.appinfo which can then be consumed by standard vSphere Automation Tools. This has […]

    Reply
  6. Application Discovery in vSphere with VMware Tools 11 - Free Help Tech says:
    12/23/2019 at 2:19 am

    […] running software procedures inside of a GuestOS. Once enabled, this info is then released into new VM guestinfo property called guestinfo.appinfo which can then be eaten by conventional vSphere Automation Resources. This […]

    Reply
  7. Application Discovery in vSphere with VMware Tools 11 - VMware Cloud Community says:
    01/17/2020 at 8:01 am

    […] application processes within a GuestOS. Once enabled, this information is then published into new VM guestinfo property called guestinfo.appinfo which can then be consumed by standard vSphere Automation Tools. This […]

    Reply
  8. Exploring the new vSphere with Tanzu VM Service with Nested ESXi says:
    05/05/2021 at 7:53 am

    […] his blog post first, a couple of things quickly caught my attention. The first was a reference to OvfEnv transport with the YAML manifests and the second was that he was able to deploy an Ubuntu VM, which […]

    Reply
  9. Exploring the new vSphere with Tanzu VM Service with Nested ESXi – CloudNerve.com – Hybrid and Multi-Cloud Services and Solutions says:
    05/05/2021 at 10:28 am

    […] post first, a couple of things quickly caught my attention. The first was a reference to OvfEnv transport with the YAML manifests and the second was that he was able to deploy an Ubuntu VM, […]

    Reply
  10. Enhancements to VMware Tools 12 for Container Application Discovery in vSphere  says:
    03/02/2022 at 2:22 pm

    […] to the Application Discovery feature, a new VM guestinfo variable has been introduced called guestinfo.vmtools.containerinfo that will be populated with the list […]

    Reply
  11. vSphere Datasets - New Virtual Machine Metadata Service in vSphere 8 says:
    09/23/2022 at 9:21 am

    […] Since the early days of Virtual Center and ESX, the only method for creating and sharing arbitrary metadata between the vSphere Management layer and the guest operating system was to use either guest variables (guestinfo) or the OVF runtime environment. […]

    Reply

Leave a Reply to mike leahyCancel 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

  • 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