Easy method to Check your PowerShell Version

Are you using version 5.1 or are you already switched to PowerShell version 7? The PowerShell version that you have installed determines the cmdlets and features that you can use. But how do you know which version you have installed? Well, you can check your PowerShell version with a single command.

The PowerShell version that you are using determines which cmdlets and features you can use. Scripts designed for PowerShell version 5 might not work as expected in PowerShell 7. So it’s important to know which version you are using.

In this article, we are going to take a look at how to find the version quickly with a single command, how you can extra the version number to use inside your script and check the version on a remote machine.

Check PowerShell Version

We can check the PowerShell version that you are using with the help of a PowerShell system variable. With a single command, we can find the exact version number:

Time needed: 1 minute

  1. Open PowerShell

  2. Type $host


    In PowerShell, type $host and press enter

    get powershell version

  3. Find the Version line


    You will find the version that you are running on the second-line Version. In this example 7.1.3

If you want a more user-friendly layout then you can also use $host.Version cmdlet:

$host.Version
check powershell version
PowerShell Version

Sometimes you need to check the installed version in a script to know which cmdlets you can use. For this, you can even filter the output more with:

$Host.Version.Major

There are also a couple of other commands that you can use to get the version number. But a commonly used alternative is the $PsVersionTable host variable. This variable is recommended everywhere on the internet, but I always forget it. ($host is easier to remember 😉 )

$PSVersionTable.PSVersion

# Output
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  1237
show powershell version

Get PowerShell Version from Remote Host

Before you can run a script on a remote computer you sometimes first need to check which version is installed. Some servers may still have only version 2 or 3 installed, which may limit the cmdlets that you can use on your script.

To get the version from a remote host we are going to use the invoke-command cmdlet. This allows us the run a script block on a remote computer and return the results to use:

Invoke-Command -Computername lazy-lab11 -Scriptblock {$PSVersionTable.PSVersion}

Updating your PowerShell

PowerShell is a built-in tool in Windows, which means that it is updated with Windows Updates. In Windows 10 and Windows 11, you get PowerShell 5.1 by default. To update to PowerShell 7 you will need to use an install package.

At the moment of writing, PowerShell 7.3 is the latest version. You can find all possible installer options here at Microsoft. Simply download the latest MSI file to install it on your computer.

Wrapping Up

There is not much more to explain when it comes to looking up the version of PowerShell. If you would like to know how to update PowerShell, then make sure you read this article.

I hope you found this article useful, if you have any questions just drop a comment below.

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

1 thought on “Easy method to Check your PowerShell Version”

  1. Hi,
    attention the type is different between ps v5.1 and pscore :
    $PSVersionTable.PSVersion.GetType()

    IsPublic IsSerial Name BaseType
    ——– ——– —- ——–
    True False SemanticVersion System.Object

Leave a Comment

0 Shares
Tweet
Pin
Share
Share