How to determine PowerShell version
To determine the local PowerShell version, use the command $PSVersionTable. The first example is version 2 while the second is version 3.
PS C:\> $PSVersionTable
Name Value
---- -----
CLRVersion 2.0.50727.5472
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
$PSVersionTable
Name Value
---- -----
WSManStackVersion 3.0
PSCompatibleVersions {1.0, 2.0, 3.0}
SerializationVersion 1.1.0.1
BuildVersion 6.2.9200.16398
PSVersion 3.0
CLRVersion 4.0.30319.1008
PSRemotingProtocolVersion 2.2