Decoding PowerShell build numbers
There are several ways to determine what version of Windows PowerShell you are running on a computer. The most common technique is to use the $PSVersionTable automatic variable:
Here, we can see the PowerShell version number in the PSVersion property.
Until PowerShell 5.0 was released as part of Windows Management Framework 5.0, the build number was rounded to .0, such as 1.0, 2.0, 3.0, and 4.0. However, in this new and fast moving pace Microsoft have gotten into, we will see more frequent updates to PowerShell than before. Due to this, the PowerShell version number isn’t simply 5.0 anymore as you might have expected. Now it’s a full build number, such as 5.0.10586.117 for the RTM release of Windows Management Framework 5 for downlevel operating systems.
If you are used to testing preview build of the Windows Management Framework in earlier versions, you might be familiar with the notion of build numbers. However, it’s getting harder to keep track of what build number maps to what version of PowerShell. For example, is 5.0.10586.51 a preview version or an RTM version? Without any form of mapping information, it’s very difficult to know.
Because of this difficulty, I decided to create PowerShell function which can read a mapping table and convert the PSVersion property to a “PSFriendlyVersionName” which makes more sense to a user. Here you can see Get-PSVersion in action:
The function is reading a JSON file where the mapping information is defined:
Since Microsoft does not provide any PowerShell build number reference, it is up to us – the community – to maintain this mapping information. I have added the RTM build numbers down to version 2 (it does not make sense to add version 1, since PowerShell Remoting which the function leverages was introduced in version 2), but there are a lot of build numbers for preview versions to add.
I have put both the Get-PSVersion function and the JSON file in a PowerShell module, in order to make it easy to download from the PowerShell Gallery. This means you can simply type Install-Module -Name PSVersion to install it directly from the gallery. Or, you can of course use Save-Module first if you want to inspect the content before installing it. The module is also available on my GitHub account, where you can fork it and send a pull request if you have any contributions to either the Get-PSVersion function or the JSON mapping file. I have also created a TechNet Wiki site called Windows PowerShell build numbers as a reference for those who don`t want to leverage the PSVersion module.