If you need to know which PowerShell version is installed on your machine, use automatic variable $PSVersiontable. Here’s output for same from my machine:
PS C:\Windows\system32> $PSVersionTable Name Value ---- ----- PSVersion 5.0.10586.494 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.10586.494 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
If you just need version, use $PSVersionTable.PSVersion:
PS C:\Windows\system32> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 0 10586 494