How to Determine installed PowerShell Version

There are multiple approaches to check what version of PowerShell is installed on the machine. Two of the best approaches are listed below.

  1. $PSVersionTable
  2. Get-Host

How to Determine installed PowerShell Version?

If the PowerShell version 2.0, 3.0, 4.0 or 5.0 and above is installed in the machine then Get-Host will run properly and below is the result that it provides when you run Get-Host.

PS C:\> Get-Host

Name             : ConsoleHost
Version          : 5.0.10586.122
InstanceId       : 48251136-d3c4-4e38-81c2-2394611f26f1
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

PS C:\>

The instance ID from machine to machine will be different and Get-Host will not return the proper result if you are running the command via a remote PowerShell session.

$PSVersionTable is the best command to run and it will produce the following results when you run on machines with PowerShell 2.0, 3.0, 4.0 and 5.x installed.

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10586.122
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.122
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3

Alternatively, if you need just need only the Major and Minor version details then you could use the command $PSVersionTable.PSVersion. This will return you the following output in the console.

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  122
Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like