PoshTIP #3 – Determine installed PowerShell version

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.

First method

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.

Second method

Use the registry database and check the following key :

Get-ItemProperty HKLM:SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name PowerShellVersion
About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /homepages/36/d512170128/htdocs/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048