Deploying a new OVA/OVF containing OVF properties that need to be configured is super easy using PowerCLI's Get-OvfConfiguration and Import-VApp cmdlets. Many examples can be found online including the PowerCLI Deployment Github repository.

However, once an OVA/OVF has been deployed and running as a standard Virtual Machine, I found there were no out of the box cmdlets for manipulating the OVF properties for a VM as shown in the screenshot below.

Online searches also did not yield any results and hence the opopournity and article 🙂

Just like any VM reconfiguration, you will need to use the vSphere API ReconfigVM_Task() and to update various OVF settings for a VM, you will need to pass in VAppConfigSpec along with a VAppPropertySpec containing the individual OVF property values to update.

To demonstrate the use of this vSphere API, I have created a sample PowerCLI script called VMOvfProperty.ps1 which contains both a Get and Set function.

Here is an example of calling the Get-VMOvfProperty function which simply accepts a VM object (returned by Get-VM) and outputs the OVF property ID, Label, current value and Description as shown in the screenshot below.

If we now want to update some of these OVF properties, we can use the Set-VMOvfProperty which also accepts a VM object along with a hashtable that contains the OVF property IDs and their respective values to update. Below is an example on how to build the PowerShell hashtable based on the output provided above.

We now simply feed our $ovfPropertyChanges hashtable along with the VM object to our Set-VMOvfProperty function as shown in the screenshot below.

If we now refresh our vSphere Web Client, we can see the OVF properties have been updated with the expected values.

You can also use the Get-VMOvfProperty function to confirm the changes.

3 thoughts on “Updating OVF properties for a VM using vSphere API and PowerCLI 

  1. How do I do something like this to just an ESXi host? All these require a vCenter. What if I need to deploy a VM that is not a vCenter (VCSA) to a standalone host. The VM will be used to deploy the rest of my SDDC stack.

  2. Thanks, I think i was using –allowextraconfig and –allowallextraconfig after the host told me after it saw the additional properties. I even opened a GSS case and they could not help me. I’ll give this a go.

Thanks for the comment!

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