This tutorial outlines multiple methods for determining the installed version of PowerShell.

Get Installed Powershell Version

There are multiple ways to get installed version in powershell

  • Using $PSVersionTable Variable: The $PSVersionTable variable contains essential version information for PowerShell.

    PS E:\work\powershell> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      5.1.21996.1
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.21996.1
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    

    It includes various properties such as PSVersion, PSEdition, PSCompatibleVersions, and BuildVersion, each providing details about the PowerShell environment.

    To retrieve the current installed PowerShell version:

    PS E:\work\powershell> $PSVersionTable.PSVersion
    
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    5      1      21996  1
    
  • use Get-Host cmdlet The Get-Host cmdlet offers information about the running program, including the PowerShell version.

    PS E:\work\powershell> Get-Host
    Name             : ConsoleHost
    Version          : 5.1.21996.1
    InstanceId       : 832c43e6-41ec-47b2-9b74-d1488ecb1b21
    UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
    CurrentCulture   : en-IN
    CurrentUICulture : en-US
    PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
    DebuggerEnabled  : True
    IsRunspacePushed : False
    Runspace         : System.Management.Automation.Runspaces.LocalRunspace
    
  • use pwsh command in 6.x version

    The pwsh command is specific to PowerShell Core versions 6.x and above. It is used to launch PowerShell Core.

    pwsh -v
    pwsh --version
    
  • using $host command The $host variable is an inbuilt variable in PowerShell that provides version information.

    PS C:\> $host
    Name             : ConsoleHost
    Version          : 5.1.21996.1
    InstanceId       : 84e4a464-a52e-43d0-9d26-f09ab52cf76d
    UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
    CurrentCulture   : en-IN
    CurrentUICulture : en-US
    PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
    DebuggerEnabled  : True
    IsRunspacePushed : False
    Runspace         : System.Management.Automation.Runspaces.LocalRunspace