Skip to content

ESXi Version Information now available as JSON (incl. Script example)

Out of many reasons, I need VMware ESXi version information in a format that can be reused in scripts. I maintain a manual list since a couple of years but this list can't be used for automation purposes. VMware does not provide this information in the required format, so I created my own database which is now also available as JSON file.

esxi-releases-json

I've also written a small script to demonstrate what this information can be used for.

JSON Description
Some attributes might not be self-explaining. This is how I build the JSON:

{
    "data": {
        "esxiReleases": [
            {
                "build": "[ESXi Build Number]",
                "friendlyName": "[Name used at https://kb.vmware.com/kb/1014508]",
                "imageProfile": "[Image Profile to update to this Build]",
                "minorRelease": "[5.1, 5.5, 5.0]",
                "patchRelease": "[Name of the Patch to this Build]",
                "releaseDate": "[Release Date YYYY-MM-DD]",
                "releaseFullName": "[API Name (vmware -v)]",
                "releaseLevel": "[Release Level (vmware -l)]",
                "updateRelease": "[Release Level used in HCL (eg. ESXi 5.1)]"
            },
            [...]
        ]
    },
    "timestamp": [JSON file creation timestamp],
    "totalCount": [Number of entries]
}

JSON File

http://www.virten.net/repo/esxiReleases.json

The JSON file is automatically updated when new releases are available. Feel free to use the link in your own scripts. I try to keep the link and format active. If you have questions or need any further information, please comment or contact me.

Please let me known if you are using this file in any automated process. You don't have to, but when I known that someone is using it, its more unlikely that I change the format or link.

PowerCLI Script Example
To demonstrate what these information can be used for, I've created a little script that compares the ESXi Build repository in my JSON file to all ESXi Hosts connected to your vCenter Server and displays the following information:

  • Current Build Number (Easy, available with Get-VMHost |select Build)
  • Release Level (eg. 5.5, 5.5 U1 or 5.5 U2. The release level changes after updates, not after patches. This information is required for HCL checks for example. It's not so easy to get this information in scripts. The script compares the Build against my repository.)
  • Patch Level (eg. ESXi 6.0 Express Patch 2 - Patches can be sub-versions of updates.)
  • Release Date (Release date of the version that is running on your Host - How old is your ESXi?)
  • Latest Verison Check (Are Updates available?)

scripted-esxi-version-information

check_esxi_version_with_json.ps1

$esxiReleases = Invoke-WebRequest -Uri http://www.virten.net/repo/esxiReleases.json | ConvertFrom-Json
$vmHosts = Get-VMHost

Foreach ($vmHost in $vmHosts) {
  $buildFound = $false
  Write-Host "ESXi Host $($vmHost.Name) is running on Build $($vmHost.Build)"

  Foreach ($release in $esxiReleases.data.esxiReleases) {
    If ($vmHost.Build -eq $release.Build) {
      Write-Host " - Release Level: $($release.releaseLevel)"
      Write-Host " - Patch Level: $($release.friendlyName)"
      Write-Host " - Release Date: $($release.releaseDate)"
      $minorRelease = $($release.minorRelease)
      $buildFound = $true
             
      Foreach ($rel in $esxiReleases.data.esxiReleases) {
        If ($minorRelease -eq $rel.minorRelease) {
          $latestBuild = $rel.build
          $latestPatch = $rel.friendlyName
          break
        }
      }
    
      if($latestBuild -eq $vmHost.Build) {
        Write-Host " - $($vmHost.Name) is running the latest version!"  -ForegroundColor Green
      } else {
        Write-Host " - $($vmHost.Name) update available: $($latestPatch) ($($latestBuild))"  -ForegroundColor Red
      }
    }
  }
  If (-Not $buildFound){
    Write-Host " - Build $($vmHost.Build) not found in database!" -ForegroundColor Red
  }
}

The script is available on Github.

9 thoughts on “ESXi Version Information now available as JSON (incl. Script example)”

  1. Thx for the great json solution.

    Is it possible to extend the Json with a check for VCenter Version too?

    So it is simple possible to check VMware infrastructures by Scripts?

    1. I don't have a reasonable source for vCenter builds. It's a little bit more complex because there are two types of vCenters (Linux Appliance and Windows based Application). Creating such a list is on my future topic list...

  2. This is great, for the vcenter part, vmware is deprecating windows version, can't make an Linux Appliance version only ? Would be awsome. Thx for this anyway really appreciate

    1. As this file includes a full history of all vCenter versions, I don't see a use-case for a linux-only version. If you are using the JSON for anything, you can easily filter it yourself.

  3. Florian,

    Spotted an incorrect value for "releaseFullName" on ESXi build 9214924. It displays as "VMware ESXi 6.7.0 build-8941472" instead.

    {
    "build": "9214924",
    "minorRelease": "6.7",
    "updateRelease": "ESXi 6.7",
    "releaseLevel": "VMware ESXi 6.7.0 GA",
    "releaseFullName": "VMware ESXi 6.7.0 build-8941472",
    "friendlyName": "ESXi 6.7 Express Patch 2a",
    "patchRelease": "ESXi670-201807001",
    "releaseDate": "2018-07-26",
    "imageProfile": "ESXi-6.7.0-20180704001-standard"
    }

Leave a Reply

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