How to check what version of PowerShell is installed

The following two commands will provide information on what version of PowerShell is installed on your local Windows machines.

Get-Host
$PSVersionTable

Get-Host will produce the following results when run on machines with PowerShell 2.0, 3.0, 4.0 and 5.x installed. NOTE: “InstanceID” varies per machine. Also, Get-Host will not produce the proper version if running via a remote PowerShell session.

Name             : ConsoleHost
Version          : 2.0
InstanceId       : 15a80496-e0d1-469e-82cb-e08ae8f0ed2e
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Name             : ConsoleHost
Version          : 3.0
InstanceId       : 0add94ef-4601-4bb5-98bc-d167b291f678
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Name             : ConsoleHost
Version          : 4.0
InstanceId       : dc3642ff-58c5-4eb4-80d0-7fc889bf8178
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Name             : ConsoleHost
Version          : 5.0.10586.117
InstanceId       : d355c49a-810c-42e0-87db-368a87bba424
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

 

$PSVersionTable will produce the following results when run on machines with PowerShell 2.0, 3.0, 4.0 and 5.x installed…

Name                           Value
----                           -----
CLRVersion                     2.0.50727.5477
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1
Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18444
BuildVersion                   6.2.9200.16398
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34014
BuildVersion                   6.3.9600.17090
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

 

If you don’t want to see all of the fluff from the base commands above, try these two commands…

Get-Host | fl Version
$PSVersionTable.PSVersion

 

Have fun.

Reference(s):

 

Updated 25 February 2016

Advertisements

4 thoughts on “How to check what version of PowerShell is installed

    • Thanks, Tommy. I appreciate the additional information. Tried it on several machines, with varying architectures and OS, and for me both commands provide the same basic information I need regarding the version of PowerShell installed.

      For me, there are too many conflicting articles to make a determination on what one tool is right. Therefore (and for the time being), I will continue using both until I see something different in the tests I run–or until we hear from the likes of a Don Jones or Jeffrey Snover or other PowerShell MVPs.

      Get-Host ( http://technet.microsoft.com/en-us/library/hh849946.aspx ) … “The default display includes the Windows PowerShell version number“.

      Additionally ( http://technet.microsoft.com/en-us/library/ee176850.aspx ) … “The Get-Host cmdlet returns information (such as the version number) for Windows PowerShell“.

    • Alright! I pinged one PowerShell MVP (Jeffery Hicks) and he confirmed $PSVersionTable is a tool to use.

      He suggested we run one of the following commands to provide the output we are looking for to get the PowerShell version installed on a machine.

      1) $psversiontable.psversion (as recommended in this article)

      2) $psversiontable.psversion.major

      3) $psversiontable.psversion.tostring()

      In the mouth of two or three witnesses shall every word be established.” I am still looking for at least one more witness and will update accordingly.

    • Here is another response from a PowerShell MVP (Jason Helmick)…

      To locate the PowerShell host version I normally just use Get-Host and look at the version property. $PSVersionTable provides the same information but also includes versions of other WMF components. So – if I wanted to know anything other then the host version – which is rare – I would $PSVersionTable – such as the version of Remoting or the CLR. again – you usually just need the version property from Get-Host.

      Even amongst MVPs, we still don’t have a consensus on which is the “superior” command other than both provide the needed information. I guess the choice is ours depending on the need.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s