Detect installed PowerShell version

Look at $PSVersionTable

For example on Windows 10 (Build 17134) it has this value

Name Value
--- ---
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}                         
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

The value of PSVersion indicates that PowerShell 5 is being used.

Last updated