Upgrade an Appliance with OvfTools

Appliances are hot!

Each appliance, delivered as an OVA or OVF, can have one or more properties attached to it. These properties are mostly used to configure the appliance. In PowerCLI we have the Get-OvfConfiguration cmdlet. It returns the user configurable properties from an OVF or OVA file in a hash table.

But what about upgrading an appliance? Most, if not all, of the Ovf Properties are already entered for the older version of the appliance. Can’t we use that information to upgrade the appliance? And avoid having to retype all that information?

And to take away the suspense, of course, that can be done with a bit of PowerShell!

The OvfTools


Line 18: The vApp properties can be found under the VAppConfig property in a VAppConfigInfo object.

Line 19: In the current version of the function we only look at the UserConfigurable properties.

Line 43: The Update-OvfVm function can accept multiple PSCredential objects. And in this way can handle multiple Ovf Properties of type password.

Line 52-60: Poor man’s version of OBN.

Line 68-70: The lines that handle Ovf Properties of type password.

Line 83: Use the Import-VApp cmdlet with the self-constructed OvfConfiguration hash table to import the new appliance.

Sample Run with OvfTools

A recent Appliance that is seeing quite a bit of updates, is the OpBot appliance from Opvizor. See my ChatOps Bot post for more information and further links.

The OpBot appliance has quite a number of properties that need to be provided on installation.

Once installed you can check these Ovf Properties via the vApp Options page. In the case of the OpBot appliance, this also contains the Slack integration token.

With the help of the OvfTools functions, I’m going to upgrade my OpBot v2.0 installation to the newer OpBot v2.0.1 version. And that without having to retype all the Ovf Properties.

The OvfTools functions assume that the version from which you want to copy the Ovf Properties is installed. The appliance doesn’t need to be running. First let’s have a look at what the Get-OvfVm function returns.

And all the properties we saw earlier via the vApp Options page, are returned.

Password property

There is one kind of property that we can’t retrieve this way, these are the properties of type Password. To circumvent that issue, I have written the Update-OvfVm function in such a way that the user can provide these passwords via a separate parameter. Consider this a security measure.

In short, the function caller needs to created a PSCredential object, where the User is the Name of the Ovf Password property.

First determine the password (1) properties, and find the propertyname (2).

In the script create a PSCredential object (3) where the username is equal to the propertyname (2). Pass the PSCredential object(s) on the call to the Update-OvfVm function (4).

The complete script to update the OpBot VM from v2.0 to v2.0.1 looks like this.

After the script is executed, the new version of the OpBot is deployed. The Ovf Properties are all copied. The switch from the old to the new appliance with some PowerCLI cmdlets should be trivial.





    Thanks Luc, very cool. We´re going to integrate it into our manual! Dennis


      Thanks Dennis

    Markus Kraus

    Great Article, very handy.

    Like the “Poor man’s version of OBN”.

Leave a Reply

Your email address will not be published. Required fields are marked *


Buy the Book