How To Check Your PowerShell Version

Are you running the latest version of PowerShell? Here’s how to check your version on Windows or Linux – plus, how to upgrade to the latest build.

Brien Posey

October 6, 2022

4 Min Read
How To Check Your PowerShell Version
Alamy

A somewhat odd thing about PowerShell is that it may not be readily apparent which version you are running. Other Microsoft command line environments such as DOS and the Windows Command Prompt show you version information as soon as they launch. This is not the case with PowerShell.

In this article, you will learn how to check which PowerShell version you have.

Before moving ahead, I want to address one simple question: Why does the PowerShell version even matter? The reason is because newer versions often support cmdlets and syntax rules that simply do not exist in older versions. This is especially true of PowerShell 7.0, which introduced support for parallel operations, ternary operators, pipeline chain operators, and more. Such features do not exist in older PowerShell versions.

What Are the Commands to Check the PowerShell Version?

The way to check your PowerShell version depends on how you are running it.

Checking the PowerShell version on Windows

If you are running PowerShell within Windows, here is the primary command for checking your PowerShell version:

Get-Host | Select-Object Version

As a shortcut, you can instead type:

$Host.Version

You can see examples of these commands in Figure 1.

PowerShell screenshot demonstrates Get-Host | Select-Object and $Host.Version commands

PowerShell Version 1

Figure 1. There are two different ways that you can check your PowerShell version in Windows.

Related:3 Ways to Download a File in PowerShell

Checking the PowerShell version on Linux

Although PowerShell is probably best known as a command line interface for Windows, Microsoft has created a cross platform edition of PowerShell known as PowerShell Core. PowerShell Core is based on .NET Core (as opposed to the full .NET Framework) and supports far fewer cmdlets than Windows PowerShell. The one thing that PowerShell Core has going for it, however, is that it works with non-Windows environments such as Linux.

If you are running PowerShell Core on Linux, you can check the PowerShell version by opening the Terminal (if necessary) and entering pwsh --version. (Note that this command is meant to be run from the Linux command line, not from within PowerShell.) You can see what this looks like in Figure 2.

Linux screenshot demonstrates the pwsh --version command for checking your PowerShell version

PowerShell Version 2

Figure 2. Linux lets you to check the PowerShell version using the pwsh --version command.

You can launch PowerShell (assuming that it is installed) by using the pwsh command. Once PowerShell is running, you can check its version by using the same commands used in Windows PowerShell. See Figure 3 for an example.

Screenshot of PowerShell running on Linux. The Get-Host | Select-Object Version command is demonstrated.

PowerShell Version 3

Figure 3. Once running, you can check the PowerShell version in Linux the same way that you do in Windows PowerShell.

What Are the PowerShell Version Numbers?

As of publishing this article, these are the existing versions of PowerShell.

Upgrade to a New Version of PowerShell

So, what happens if you check the PowerShell version and discover that you need a newer version?

One option is to run Windows Update. However, Windows Update will not always install the latest version of PowerShell. If you want the most recent PowerShell build, you will have to download it from Microsoft.

Microsoft offers different installation options, such as Winget, MSI packages, ZIP files, and even Microsoft Store packages. As such, you can choose the option that works best for your own situation.

Based on my experience, the easiest option is to download an MSI package. Just download and then double-click the MSI file. Windows will launch a GUI-based installer like the one shown in Figure 4.

Screenshot of PowerShell 7-x64 Setup window

PowerShell Version 4

Figure 4. The PowerShell MSI files include a GUI based installer.

Conclusion

Checking your PowerShell version isn’t something you will probably do daily, but it is important to know the version you have. As noted above, some PowerShell cmdlets will run only on specific PowerShell versions. Hence, if you are having trouble getting a command to work, you might check to make sure that you are running the required PowerShell version.

About the Author

Brien Posey

Brien Posey is a bestselling technology author, a speaker, and a 20X Microsoft MVP. In addition to his ongoing work in IT, Posey has spent the last several years training as a commercial astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space.

http://brienposey.com/

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like