close

Home

PowerShell

How to Check Your PowerShell Version

Author avatar - Michael Reinders

Michael Reinders

|
PowerShell

Whether you’re a PowerShell pro or just starting out, it’s useful to know how to check your PowerShell version. We’ll explain how to do that in this guide.

How to check your PowerShell version

Let’s quickly check the version of PowerShell installed on your device:

  1. Launch PowerShell by opening the Start menu and typing powershell.
  2. In the list of search results, click Windows PowerShell or PowerShell v7.
  3. In the PowerShell window, type $PSVersionTable.PSVersion and press ENTER to get the exact version of PowerShell.

For more details on the different ways to check the PowerShell version, and getting the version of PowerShell installed on remote systems, keep reading!

From PowerShell 1.0, to Windows PowerShell, to PowerShell v7- but which version are you using?

PowerShell 1.0 was released in 2006 for the Windows operating system, including Windows XP (SP2), Windows Server 2003 (r2 SP1), and Windows Vista. It is part of the .NET framework and even comes with a graphical program called the PowerShell ISE. You can search for it in the Start menu.

Searching for the PowerShell ISE in the Start Menu
Searching for the PowerShell ISE in the Start Menu

In typical Microsoft fashion, there is a myriad of ways to determine what version of PowerShell you’re running. However, you should be careful in using the ‘best’ one as some methods won’t necessarily give you the accurate results you’re looking for – especially if you need to satisfy a certain requirement or prerequisite before you can run a specific command or load a certain module.

But don’t worry, I’ll go through some of the basic methods and then finish with the silver bullet you should definitely keep in your PowerShell toolbelt.

The Get-Host command and $host commands

The basic ‘client-server’ dynamic that PowerShell uses is the concept of a host. A host is a program that is hosting PowerShell.

You can have multiple versions of PowerShell hosts installed on a computer, so each engine of PowerShell is its own host. The main culprit for the inaccuracy of the following commands is that you can have a host that has a version that is independent of PowerShell itself.

Let me show you by opening a new PowerShell window on my Windows 11 client in my Windows Server 2022 Active Directory lab environment (Hyper-V). You can also specify your PowerShell console as your default profile in Windows Terminal.

The Get-Host command

You can use the Get-Host command to get an idea of the version of PowerShell you’re running. However, again, this can be inaccurate.

Get-Host
Using the Get-Host command - for now, it's accurate
Using the Get-Host command – for now, it’s accurate…

The $host and $host.Version commands

The $host variable is an automatic variable that returns the same output as the above ‘Get-Host’ command.

$host
$host.Version
The $host and $host.Version commands
The $host and $host.Version commands

As you can see, the output is identical to the original commands above.

Why are these two commands not always recommended?

I’ll get to why these two commands are not reliable in a bit. But, let me give you a sneak preview. When I run a command on a remote computer (one of my Windows Server 2022 Domain Controllers), it does not report accurate results.

Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {$host.Version} -Credential $cred
The $host.Version command, when run remotely, does NOT report accurate results

The $PSVersionTable command

So, remember when I was talking about a silver bullet? Well, this is it. The native command we’ll use is the PSVersionTable automatic variable that returns information specifically about the PowerShell engine version.

The $PSVersionTable command not only returns the version of PowerShell, but also the ‘Edition’. Incidentally, this command will also report if you’re running PowerShell Core or PowerShell Desktop.

$PSVersionTable
The $PSVersionTable command works wonderfully
The $PSVersionTable command works wonderfully!

How to check your PowerShell version using Registry

As with nearly every application and feature in Windows, you can open the Registry to get configuration and version information. This includes PowerShell. You can run this command to view the PowerShellVersion registry key with the ‘Get-ItemProperty’ command.

(Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersion
Accessing the Registry to determine PowerShell version information

How to check the PowerShell version on remote PCs

Thanks to the robustness and scalability of PowerShell, you can verify the versions of PowerShell on remote computers, too. You can use the same commands as if you were locally on the remote machine. However, there are a few prerequisites you’ll want to verify on your remote machines first.

The most basic is to verify Windows Management Framework (WMF) is installed and enabled. You can run the winrm quickconfig command one time on the remote machine (as an Administrator) to have Windows take care of all the checks and balances.

winrm quickconfig
Running 'winrm quickconfig' prepares a machine to be remotely accessed via PowerShell
Running ‘winrm quickconfig’ prepares a machine to be remotely accessed via PowerShell

After preparing a PC to be remotely accessed by PowerShell, here are some examples of the remote commands you can run to verify PowerShell versions. Let’s start with the Get-Host command

Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {Get-Host} -Credential $cred
Checking remote PowerShell versions isn’t accurate using these earlier commands…

Again, this is one of my Windows Server 2022 DCs reporting the inaccurate version of 1.0. This is NOT correct. So, again, you’ll want to use our silver bullet remotely, too, the $PSVersionTable command.

Using $PSVersionTable on remote PCs

The $PSVersionTable command, when run remotely, will accurately report the version of PowerShell running on the remote computer.

Invoke-Command -ComputerName WS16-DC1 -ScriptBlock {$PSVersionTable.PSVersion} -Credential $cred 
Using $PSVersionTable remotely works wonderfully!
Using $PSVersionTable remotely works wonderfully!

How can I install the latest version of PowerShell?

Again, as per typical Microsoft fashion, there are even little hints when launching PowerShell that there are better and brighter versions you could be using. Will they stop at nothing? Is nothing sacred? 😉

Microsoft 'advertising' later versions of PowerShell when you launch PowerShell
Microsoft ‘advertising’ later versions of PowerShell when you…launch PowerShell!

So, let me give you a few methods you can use to install a more recent and secure version of PowerShell.

Microsoft Store

On Windows 10 and Windows 11, you can just open the Microsoft Store and search for PowerShell.

Downloading PowerShell from the Microsoft Store
Downloading PowerShell from the Microsoft Store

WinGet

You can use the package manager, WinGet, to download the latest version from your favorite command line/terminal. Because the winget command can download PowerShell from various repositories, (Microsoft Store (msstore) or ‘winget’), I use the ‘-s’ option to specify ‘winget.’

winget show PowerShell -s winget
Downloading the latest version of PowerShell right from the command line
Downloading the latest version of PowerShell right from the command line – No websites to browse!

Information superhighway

You can also browse Microsoft’s Docs website to download various package types of PowerShell.

Downloading PowerShell for Windows from Microsoft's Docs website
PowerShell for Windows Download Site

Are you looking for a macOS version? Browse here! What about Linux? You guessed it. PowerShell is cross-platform and open source. Grab the Linux version here!

Conclusion

I hope you learned a little bit more about PowerShell and how to determine what version of it your computer is running. You also have several avenues to download and install the latest version on your PCs, and my own preference is using winget.

Please feel free to leave a comment if you have any questions or want to voice your opinions. Thank you for reading!

Article saved!

Access saved content from your profile page. View Saved