How To Discover The Installed Version Of PowerShell


How can we discover which version of PowerShell we are running on?

Quick Answer

We can use the $PSVersionTable system variable:


This will return an object with the installed version build numbers:

PowerShell Installed Version

Long Answer

We can use $PSVersionTable to discover the versions of different components of PowerShell:

PowerShell Versions

For example:

  • CLRVersion property shows the installed version of the CLR.
  • PSCompatibleVersions shows us what script versions we can run on the current installed versions.

Notably, the PSVersion shows the installed version of PowerShell:

PowerShell Installed Version

Knowing this, we can then use this property to make decisions based on the installed version:

if ($PSVersionTable.PSVersion.Major -ge 4)
    "This is a supported version"
    throw "Please upgrade PowerShell to run this script."

Easy, isn’t it?

Index: PowerShell HowTo’s


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s