Determine installed PowerShell version Determine installed PowerShell version powershell powershell

Determine installed PowerShell version


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 reflectthe version of the host only, not the engine. PowerGUI,PowerShellPLUS, etc. are all hosting applications, andthey will set the host's version to reflect their productversion — which is entirely correct, but not what you're looking for.

PS C:\> $PSVersionTable.PSVersionMajor  Minor  Build  Revision-----  -----  -----  --------4      0      -1     -1


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-hostName             : ConsoleHostVersion          : 2.0InstanceId       : d730016e-2875-4b57-9cd6-d32c8b71e18aUI               : System.Management.Automation.Internal.Host.InternalHostUserInterfaceCurrentCulture   : en-GBCurrentUICulture : en-USPrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxyIsRunspacePushed : FalseRunspace         : System.Management.Automation.Runspaces.LocalRunspace$PSVersionTableName                           Value----                           -----CLRVersion                     2.0.50727.4200BuildVersion                   6.0.6002.18111PSVersion                      2.0WSManStackVersion              2.0PSCompatibleVersions           {1.0, 2.0}SerializationVersion           1.1.0.1PSRemotingProtocolVersion      2.1


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 >  $psversiontableName                           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