Search notes:

PowerShell: the automatic variable $PsVersionTable

$psVersionTable is an automatic variable (whose type is System.Collections.Hashtable) that reveals some information about the PowerShell that runs the current session.

Determine PowerShell version

Print PowerShell's version with $PSversionTable …
PS C:\> ($psVersionTable).psVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  134
… or alternatively use get-host:
PS C:\> (get-host).version

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  134

PowerShell vs PowerShell Core

In PowerShell Core, the $psVersionTable has some differing attributes:
Attribute PS PS Core Comments
PSVersion ✓ ✓
PSCompatibleVersions ✓ ✓
PSEdition Desktop Core Core still displayed in PowerShell 7 although PowerShell 7 dropped Core from its name.
BuildVersion ✓ ✗
GitCommitId ✗ ✓
CLRVersion ✓ ✗
WSManStackVersion ✓ ✓
PSRemotingProtocolVersion ✓ ✓
SerializationVersion ✓ ✓
OS ✗ ✓
Platform ✗ ✓

See also

Other automatic variables

Index