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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758763895, '216.73.216.19', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/variable/automatic/PsVersionTable(75): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78