VMware Cloud Community
orian
Hot Shot
Hot Shot
Jump to solution

find Virtual Machine most upgradable vm version (vm hardware)

hi,

i am trying to create a workflow that automatically upgrade vmtools + vm hardwrae version for a specific virtual machine.

the vmtools upgrade process is working perfectly without any issues, i can list a predefined array of virtual machines with status "tools required updates" and then update them.

unfortunately,  i cannot find anything related to predefined condition of virtual machine hardware version (vmx-11,vmx-10 etc..) ,

my goal is to make a query which check the virtual machine current vm version and compare that to the host (esxi) most compatible vm version available.

how can i create this workflow?

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Here is sample code that prints the current vm version and all versions supported by the host (input parameter is variable vm of type VC:VirtualMachine)

System.log("VM version: " + vm.vmVersion);

System.log("Versions supported by the VM's host:");

var opts = vm.environmentBrowser.queryConfigOptionDescriptor();

for each (var opt in opts) {

  for each (var host in opt.host) {

    if (host.id == vm.runtime.host.id) {

      System.log("  " + opt.key);

      break;

    }

  }

}

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Here is sample code that prints the current vm version and all versions supported by the host (input parameter is variable vm of type VC:VirtualMachine)

System.log("VM version: " + vm.vmVersion);

System.log("Versions supported by the VM's host:");

var opts = vm.environmentBrowser.queryConfigOptionDescriptor();

for each (var opt in opts) {

  for each (var host in opt.host) {

    if (host.id == vm.runtime.host.id) {

      System.log("  " + opt.key);

      break;

    }

  }

}

0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

thank you! works as expected.

0 Kudos