How to find the Powershell version in Windows

There are many ways to find out which version of PowerShell is installed on a system. This post will go through a couple of the simplest methods.

For PowerShell v2 and up

For PowerShell v2 and upwards, you can call the $PSVersionTable:

$PSVersionTable
PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.906
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.906
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

This will provide information about the version of PowerShell that is running in the current session.

You can use Get-Help to find out more information on each item:

CLRVersion:                The version of the common language runtime (CLR)

BuildVersion:              The build number of the current version

PSVersion:                 The Windows PowerShell version number

WSManStackVersion:         The version number of the WS-Management stack

PSCompatibleVersions:      Versions of Windows PowerShell that are 
                           compatible with the current version

SerializationVersion:      The version of the serialization method

PSRemotingProtocolVersion: The version of the Windows PowerShell remote 
                           management protocol

The version number of PowerShell can be found using PSVersion:

$PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  906     

For PowerShell v1.x

For PowerShell v1.x, you will need to access the Host:

$Host
Name             : Windows PowerShell ISE Host
Version          : 5.1.19041.906
InstanceId       : b3a20d9f-d1c9-487e-8023-437573f6d303
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-GB
CurrentUICulture : en-GB
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Similarly, the version can be found by accessing the Version item:

$Host.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  906