Categories
powershell version

Determine installed PowerShell version

2790

How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?

3

  • 1

    pwsh --version should work fine. I checked on windows 11.

    – Kapil

    Oct 22, 2021 at 13:05

  • 1

    @Kapil please post that as an answer so it can be voted on along with the rest of the answers. Anyway, it didn’t work for me on Windows 10.

    – ggorlen

    Jan 26 at 23:22


  • 1

    @Kapil pwsh only works as a command if a newer PowerShell version is installed. For older versions, such as the PowerShell 5 that comes with Windows 10, the executable is called PowerShell.exe. (And there’s no --version either in older versions.)

    – Reg Edit

    Apr 26 at 16:42

3752

+50

Use $PSVersionTable.PSVersion to determine the engine version. If the variable does not exist, it is safe to assume the engine is version 1.0.

Note that $Host.Version and (Get-Host).Version are not reliable – they reflect
the version of the host only, not the engine. PowerGUI,
PowerShellPLUS, etc. are all hosting applications, and
they will set the host’s version to reflect their product
version — which is entirely correct, but not what you’re looking for.

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

10

  • 3

    @DanielCassidy – two years late to the party, but “some features are unaccountably unavailable” might be caused by only having the .Net 3.5 Compact framework installed instead of the full thing.

    Sep 24, 2012 at 14:50

  • 90

    $PSVersionTable is more reliable and returns $PSVersion. You can also use $PSVersionTable.PSVersion. Even if you are connected remotely to the machine running different version (invoke-command -computername myRemotePC -Credential foo {$host}), it looks like $host will just show the lowest version they agreed upon for serializing. While $PSVersionTable will show the true version. Hope it would help someone..

    Oct 23, 2012 at 4:27

  • 17

    Seems $host.Version isn’t a good choice… If you remote to a machine running PowerShell 3, you get back 1.0, as the RemotingHost seems to be v1. Using $PSVersionTable correctly returns 3.

    Oct 30, 2012 at 9:30

  • 26

    @Starfish The command shown launches Powershell using Command Prompt. Wouldn’t the command just error out with “powershell not found” if it’s not installed?

    – jpmc26

    Dec 12, 2013 at 4:26

  • 11

    So tired of coming back here for this that I just ran notepad $profile and dumped function psver { $PSVersionTable; $PSVersionTable.PSVersion } in it. A reload with . $profile and I can just type psver any time to get the detailed version info and other details.

    – ADTC

    May 8, 2016 at 13:13

449

I would use either Get-Host or $PSVersionTable. As Andy Schneider points out, $PSVersionTable doesn’t work in version 1; it was introduced in version 2.

get-host

Name             : ConsoleHost
Version          : 2.0
InstanceId       : d730016e-2875-4b57-9cd6-d32c8b71e18a
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-GB
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

$PSVersionTable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.4200
BuildVersion                   6.0.6002.18111
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

3

  • 5

    thank you! NB: On my XP where I manually upgraded from v1 Powershell, the actual folder and registry paths (misleadingly?!) reference v1 NOT v2. This is as others here specify, but it was the reason why I was so worried whether I had installed it. My path is ; C:\WINDOWS\system32\windowspowershell\v1.0

    Mar 7, 2012 at 20:44


  • 4

    If $psversiontable does not exist, it’s entirely safe to assume you’re on v1.0 – and hey presto, that also answers your question. $host.version is not reliable – for example in powergui, it returns the powergui host version which is not the same as the powershell engine version (which is what is desired.)

    – x0n

    Apr 17, 2013 at 20:45


  • 11

    The accepted answer states “… $Host.Version and (Get-Host).Version are not reliable – they reflect the version of the host only, not the engine”.

    Mar 4, 2017 at 9:13

103

You can look at the built in variable, $psversiontable. If it doesn’t exist, you have V1. If it does exist, it will give you all the info you need.

1 >  $psversiontable

Name                           Value                                           
----                           -----                                           
CLRVersion                     2.0.50727.4927                                  
BuildVersion                   6.1.7600.16385                                  
PSVersion                      2.0                                             
WSManStackVersion              2.0                                             
PSCompatibleVersions           {1.0, 2.0}                                      
SerializationVersion           1.1.0.1                                         
PSRemotingProtocolVersion      2.1