Get Supported Hardware Versions from Cluster

Get Supported Hardware Schema

Get Supported Hardware Schema

Quite some time ago I had the need to retrieve the supported HW versions for an environment.. I don’t remember what the project was, but it wasn’t terribly important so I didn’t bother digging deeper to figure things out - I just worked around the issue. Last month William Lam posted an article on how to do this with PERL.

In this article Which Virtual Hardware Versions (VM Compatibility) Are Supported In vSphere?, William gave a simple example using a PERL script to retrieve the desired information for a given Cluster. I just came across this today, viewed the source of the .pl file and thought - hey that looks easy enough, I should be able to replicate the results in vCenter Orchestrator (vCO).

Prerequisites

vCenter Orchestrator should have the vCenter plug-in correctly configured.

Test/Dev

  1. Create a new workflow named “Get Supported Virtual Hardware Version” and add a single Scriptable Task to it.
  2. Add a single input named “cluster” of type “VC:ClusterComputeResource” to the workflow and bind it to the scriptable task
  3. Add the following code to the scriptable task:
1
2
3
4
var virtualHWs = cluster.environmentBrowser.queryConfigOptionDescriptor();
for each (vhw in virtualHWs){
    System.log(vhw.key + " -- " + vhw.description);
}
  1. (Optional) - Go to the Presentation tab of the workflow, select the input and add a new property: Show in Inventory – this will allow you to right-click a Cluster in the vCO Inventory and run this workflow.
  2. Save and Close the workflow
  3. Run the workflow
  4. Select the desired cluster you wish to run the workflow against, then hit Submit

Upon submitting the workflow, the logs tab should display something along these lines (Your results will vary depending on your environment):

1
2
3
4
5
[2013-05-03 14:05:24.984] [I] vmx-03 -- ESX 2.x virtual machine
[2013-05-03 14:05:24.985] [I] vmx-04 -- ESX 3.x virtual machine
[2013-05-03 14:05:24.986] [I] vmx-07 -- ESX/ESXi 4.x virtual machine
[2013-05-03 14:05:24.987] [I] vmx-08 -- ESXi 5.0 virtual machine
[2013-05-03 14:05:24.987] [I] vmx-09 -- ESXi 5.1 virtual machine

Attached is the solution workflow (Right Click and Choose Save As):

file icon workflow
Get Supported Virtual Hardware Version.workflow

Next Step for you

Take the code from this script and add it to an action. Action should take the same single input, but return an array of strings containing the vmx-## values. You would then be able to use this action as a source for future workflows that need the Hardware Version as an input. The action can be specified as the source for a “Predefined List of elements” property for the input.