How To Check and Find PowerShell Version In Windows?

PowerShell is an advanced command-line interface provided with the modern Windows operating systems. PowerShell create in 2006 and updated regularly with new versions. There are multiple versions of PowerShell which adds some new features and removed some old features. So how can we decide which version of the PowerShell we are currently running. In this tutorial, we provide some ways to decide versions of the PowerShell. by the ways as writing this post the latest version of the Powershell was “7.1.3”.

Find PowerShell Version with $PSVersionTable Variable

The PowerShell provides the $PSVersionTable in order to provide detailed information about the PowerShell and related components versions. Just running the $PSVersionTable on the PowerShell command-line interface prints detailed version information about the PowerShell and related components.

PS> $PSVersionTable
Name                           Value
----                                -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions   1.0, 2.0, 3.0, 4.0...}
BuildVersion                  10.0.19041.610
CLRVersion                    4.0.30319.42000
WSManStackVersion       3.0
PSRemotingProtocolVersion      2.3
PowerShell Version Information with $PSVersionTable

The Powershell version is displayed in the PSVersion line. In this example, the PowerShell version is “5.1.1904.610”.

We can also print only the PowerShell version information by omitting other components’ versions information. The PSVersion attribute is displayed about the $PSVersionTable.

PS> $PSVersionTable.PSVersion
Major  Minor  Build       Revision
-----    -----    -----      --------
5         1         19041     610

This provides detailed output about the version information.

  • Major is the major version number which changes rearaly with big improvements in PowreShell.
  • Minor is the minor version number which changes more often than major number and changes with different improvements in PowerShell.
  • Build is the build version number which change very frequently with little improvements and bug fixes.
  • Revision is the revision number which is mainly related with the realse information and development team of the PowerShell.

Find PowerShell Version with Get-Host Commandlet

The Get-Host commandlet can be used to print PowerShell version information. The PowerShell version information is displayed in the Version line like below.

PS> Get-Host
Name             : ConsoleHost
Version          : 5.1.19041.610
InstanceId       : d4fe4087-7b69-4164-bd2d-8ab5d0eaa189
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Find PowerShell Version with Get-Host Commandlet

By calling the Version attribute only version information can be displayed with the Get-Host command like below.

PS> (Get-Host).Version
Major  Minor  Build       Revision
-----    -----    -----       --------
5         1         19041      610

Find PowerShell Version with $host Variable

The $host variable can be used to display PowerShell version information. Actually, the $host variable stores the Get-Host command information about the current host. Just call the $host variable like below to list PowerShell version information. The Version line provides the PowerShell version information.

PS> $host
Find PowerShell Version with $host Variable

The Version attribute can be used to print only PowerShell version information and omit other attributes and information.

PS> $host.Version
Major  Minor  Build       Revision
-----    -----    -----       --------
5         1         19041      610

Leave a Comment