PSVersionTable
suggest change$PSVersionTable is a read-only hash table (Constant, AllScope) of details about the PowerShell version in the current session. This sample is Windows PowerShell 5.0. PowerShell 6 and later add keys such as PSEdition, OS, and Platform, and they omit BuildVersion and CLRVersion.
$PSVersionTable # this call results in:
Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The shortest way to get the version of the running session:
$PSVersionTable.PSVersion
# result:
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 117
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents