PoshTip #3 – Determine installed PowerShell version
First of all, to check if PowerShell is installed, you need to check this registry key :
Get-ItemProperty HKLM:SOFTWARE\Microsoft\PowerShell\1 -Name Install
If it exist, then PowerShell is well installed. Below, we will see how to check the PowerShell version.
I will not describe $host.version because it is not reliable. For example in PowerGUI, it returns the PowerGUI host version which is not the same as the PowerShell engine version.
To determine the engine version, just copy and paste this code :
$PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 0 10240 16384
If $PSVersionTable does not exist, it’s entirely safe to assume that you are on v1.0.
Use the registry database and check the following key :
Get-ItemProperty HKLM:SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name PowerShellVersion