I can still remember when I was a VI Admin and how annoying it was to try to correlate the build numbers for my ESX(i) hosts and vCenter Servers that I have deployed with the versions listed on VMware's website. This especially gets challenging when there are multiple patch releases (a, b, c or 01, 02, 03) in between major releases (5.5, 6.0, 6.0u1, 6.0u2, 6.5, etc.). Historically, most customers including myself would retrieve the respective build numbers and then manually comparing them to either the release notes and/or download website which was very tedious.
Although VMware has exposed the version number within our vSphere products since day 1 which can also be retrieved programmatically using the vSphere API (here), it unfortunately does not provide more details than simply the major/minor version (e.g. 5,5, 6.0, 6.5, etc) of the software. Recently, VMware had released a series of VMware KBs which provides a mapping between the build numbers for vCenter Server, ESXi and vSAN to their respective versions which can be found in the links below:
- Build numbers and versions of VMware ESXi/ESX (2143832)
- Build numbers and versions of VMware vCenter Server (2143838)
- Build numbers and versions of VMware vSAN (2150753)
These are definitely a great set of resources that I know many customers including myself have been using since its release. Having said that, the process today is still pretty manual since you need to manually retrieve the build numbers for either a VC, ESXi or vSAN Host (can be automated using vSphere APIs) and then comparing that to the KBs to get the correct versions. How cool would it be if you could *easily* just point to YOUR environment and retrieve the version information for either a vCenter Server (Windows or VCSA), ESXi host(s) or vSAN host(s) without needing to manually perform this lookup each time? Well, I have just done that! I have taken all three KBs and converted that information into a simple PowerCLI script called VCESXivSANBuildVersion.ps1 leveraging our vSphere API and it provides three functions:
- Get-VCVersion - Retrieves the vCenter Server version given a VC connection
- Get-ESXiVersion - Retrieves the ESXi version for all hosts given a vSphere Cluster
- Get-VSANVersion - Retrieves the vSAN version for all hosts given a vSAN Cluster
Here is an example output using the first two functions:
For the vCenter Server version output, you will notice that I am also including the OS platform of your vCenter Server, so you can distinguish between a Windows vCenter Server and a vCenter Server Appliance (VCSA) which can be useful to see if you have been #migrate2vcsa ;). For the ESXi version output, you will notice the "OriginalInstallDate" value, this is actually new API property that was introduced in vSphere 6.5 and it provides you with the original installation date of your ESXi host (more details can be found here) which is pretty neat.
Here is an example output using last function:
If you wanted to take this a step further, you could even take this output and dynamically update the vSphere UI using either Custom Attributes or vSphere Tags so you know what version the software is at any given moment. Its easy enough to set this up as a scheduled task that could run periodically so you always have the latest information provided in the vSphere UIs.
Although this is a significant improvement over the existing manual methods, I think most of you will agree that it would be ideal if this information was natively available within the product which means BOTH UI and APIs. I think we all appreciate versioning of software is not always easy and it can change from release to release for a variety of reasons, most of which may not be technical. If the vSphere platform could dynamically pull this information in either real time and/or through an offline mechanism and provide this association by default, it would greatly improve the experience when needing to troubleshoot or perform maintenance of the vSphere platform. If this is something you would like to see, please leave a comment below providing your feedback. I know I have already pinged our PMs about this and I am sure they would love to hear form you as well!
Additional Information:
Note1: Update levels can be found using the vSphere API, take a look at this article here for more details.
Note2: As of ESXi 6.5 Update 1, the Update levels are also included by default in the Embedded Host Client as shown in the screenshot below:
Note3: As of vSAN 6.2, the vSAN Management API already includes vSAN version information that can be queried. Take a look at this script here which exercises this new API. For example above, I decided to not use this new API since customers may be running older releases of vSAN which is not covered by the vSAN Mgmt API.
Note4: VMware has also published simliar build to version mapping for other VMware products which can find the complete list here.
adamg says
Hey William, great stuff as usual! I read a rumor a while ago from a VMware employee over on the HTML5 fling site that stated VMware was going to remove all references to the build number in the software, as it's only used by internal engineering. I won't go on about how bad I think this is 🙂 but do you know anything about this? If so, put me down on the "keep the build number" list. Thanks again!
Steffen Oezcan says
Hey William, those KB articles are not very new, it just used to be one single article for both vCenter Server, ESXi and some SDDC-related products. Have been using this single and now the multiple ones ever since.
Would really not like if the build numbers could not be easily retrieved anymore from the UIs - please keep em!
Also, +1 for showing the Update release in UI as well as API. Always a PITA to manually map these when talking to or preparing stuff for customers.
BR
Steffen
Seph7 says
Cheers Have Already Nested
Richard H. Shores says
I am new to PowerCLI. How do I run this script in PowerCLI?
Richard H. Shores says
Finally figured how to run the script.
Fabian Dietl says
Cheers Richard,
how did you run the script? I am completely new to PowerCLI aswell, could you provide me with some information on how to handle this thing?
Thanks in advance! =)
kondrich says
Cool script! Thank you very much! I agree that this information should be available in vCenter Web Client (Flash and HTML5).
Tim Manochehri says
Hello,
At work we have 5 Vcenters so via PowerCLI I login into multiple VCS. When I run Get-VCVerison it only shows one VC not all 5.
I have DefaultVIServermode set to multiple.
Pratik says
Hello,
When I execute the below command I get the following error to it:
Get-Cluster | Get-VSANVersion
Output:
Get-VSANVersion : The term 'Get-VSANVersion' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ Get-Cluster | Get-VSANVersion
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VSANVersion:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can you please help me how can I fix this issue.
Seth.R says
Having some issues running this on multiple vCenters. I can run it manually but want to connect to 14 vCenters run this and grab all my versions. It works file for the ESXi hosts but when I try and to run the Get-VCVersion it will just keep over writing the .csv file I am exporting the data too. I have tried changing the values in the script but still no luck it just overwrites my vcenter version and I am left with the last one of the 14. ANy help would be appreciated 🙂