Using the vSphere API, it is very easy to extract the version and build of all your ESXi hosts. This information is exposed in the Product property of an ESXi host. For example, Product.Version will return something like 6.0.0 and Product.Build will return something like 3029758. However, one thing that is not available in this property is the Update Level information for an ESXi host such as Update 1 or Update 2.
Historically, customers would have to rely on ESXCLI to pull the Update level information using the following command: esxcli system version get and though this can be run remotely or integrated into PowerCLI as shown in the example below, it would be ideal if this information was just available using the vSphere API.
This exact same question was brought up internally again today and Etienne Le Sueur actually shared an awesome tidbit on how to retrieve this information using the vSphere API. You can find the ESXi Update Level information in an ESXi Advanced Setting called Misc.HostAgentUpdateLevel
Below is a quick PowerCLI example which exercises this vSphere API to retrieve the Version, Build and Update Level information:
$vmhost = Get-VMHost -Namenuc.primp-industries.com $esxi_version = $vmhost.ExtensionData.Config.Product.Version $esxi_build = $vmhost.ExtensionData.Config.Product.Build $esxi_update_level = (Get-AdvancedSetting -Entity $vmhost -NameMisc.HostAgentUpdateLevel).value Write-Host "$vmhost" Write-Host "`tVersion: $esxi_version" Write-Host "`tUpdate: $esxi_update_level" Write-Host "`tBuild: $esxi_build"
Here is a screenshot of the output for my ESXi host which is running latest vSphere 6.0 Update 2 (including the recent patch release).
Its great to hear that the ESXi Update Level information is available through the vSphere API, although I would have liked to have seen it exposed within the Product property. Perhaps its time to file an internal Feature Request?