Powershell provides different features according to its version. Here knowing the version of the PowerShell become a necessity. There are different methods to get version of Powershell from easy to hard.

PowerShell Versions

Also PowerShell is updated with the Windows Update but following lines provides information about the PowerShell versions and related Windows or Operating System version.

Version 1.0: shipped 2006 as optional download. Obsolete.

Version 2.0: shipped 2009 as part of Windows 7/Server 2008. The only version that still supports Windows XP and Server 2003.

Version 3.0: shipped 2012 as part of Windows 8/Server 2012. Completed the core language features and started to ship the ISE Editor.

Version 4.0: shipped 2013 as part of Windows 8.1/Server 2012R2. Added DSC (Desired State Configuration)

Version 5.0: shipped 2015 as part of Windows 10. This version is a major milestone with various new features and language extensions.

Version 5.1: shipped 2016 as part of Windows 10 Anniversary Update and Server 2016.

Using PSVersionTable Environment Variable

Simplest and reliable solution is using environment variable. PSVersionTable variable provides PSVersion key for the version.

PS> $PSVersionTable.PSVersion

As we can see in the example the major version is 2 and minor version is 0. There are also more information like Build which shows the build number which is detailed minor number. There is also information like Revision which is the most little number used for versioning. As we can see both Build and Revision numbers are shown as -1 which means there is no specific information about these numbers.

Simply we can call this Powershell version as 2.0

We can also get more details about the Powershell and its version with the following command.

PS> $PSVersionTable

Get-Host Commandlet

We can also use Get-Host commandlet which will provide information about the current host and provide the Version info too.

PS> Get-Host

As we can see in the Version line the version of the Powershell is 5.1

How To Determine Installed Powershell Version? Infografic