Depending on your Operating System and how updated it is you will have a certain PowerShell version in the system.
A PowerShell version contains three or four numbers separated by periods (.) that represent the Major version number, the Minor version number, the Build number, and the Revision number (optionally).
Microsoft integrates new features inside PowerShell while improving the current ones on each successive build or version. Some editions also remove certain outdated cmdlets, so you can only use those in the previous builds.
As such, it’s best if you know what version of PowerShell you have, especially if you are getting into PowerShell scripts. This way, you’ll better understand what functionalities or cmdlets to include and what to exclude in your codes or scripts.
Current PowerShell Editions and Versions
Microsoft usually bundles a specific edition of PowerShell in its installation software, which is called Windows PowerShell. For instance, these were the PowerShell versions during the initial launch of the following Windows builds:
- Windows 10 version 1607, Windows 11 and Server 2016, 2019, 2022 – PowerShell 5.1
- Windows 10 version 1507, 1511 – PowerShell 5.0
- Windows 8.1 and Server 2012 R2 – PowerShell 4.0
Regularly updating Windows will install the necessary .NET Framework and Windows Management Framework on all these systems and update the Windows PowerShell to the latest version (5.1).
But Microsoft has continued developing PowerShell and released further editions even though they are not bundled together with the Windows Operating System. These builds are commonly called PowerShell Core to differentiate them from Windows PowerShell. However, you will usually see them as PowerShell 6.x or PowerShell 7.x.
You need to download and install the latest PowerShell versions separately to get them in your system. Microsoft provides many methods to install this application, but they may install the program in different locations. So, it’s best to keep using the same method when installing any future versions or builds as well.
How to Check the PowerShell Version?
You should already have a tentative estimate of the version while opening the program itself.
In Windows 10 and 11, the PowerShell command on Run opens Windows Powershell (version 5) while you need to use the pwsh
command to open PowerShell Core (v6 or v7). Searching PowerShell on the Search bar (Win + S) also lists Windows PowerShell, PowerShell 7, and so on.
PowerShell Core also shows the version number on the top after you open it. But you will need to run some cmdlets inside Windows PowerShell to know the full version. You can also get this information from the corresponding registry entries.
Using $PSVersionTable Cmdlet
$PSVersionTable
is the best cmdlet to check the current PowerShell version. It will show all the version information, including the version number in a table format.
- Open PowerShell.
- Type
$PSVersionTable
and press Enter. Here, check the Value of PSVersion to find the PowerShell version. - Alternatively, you can directly enter
$PSVersionTable.PSVersion
to get only the version number.
Using Get-Host or $Host Cmdlet
PowerShell uses the concept of hosts in its operation and allows other applications to host themselves using the System.Management.Automation.PowerShell class.
The Get-Host or the $host cmdlets display the information of the current PowerShell host, which is the default PowerShell Console. This information also includes the PowerShell version number.
However, keep in mind that you may not get an accurate result if you use this cmdlet as a script to get the PowerShell version on a remote computer.
- Open PowerShell.
- Enter
Get-Host
or$Host
and check the value next to Version. - Alternatively, you can directly enter one of the following cmdlets to display only the version number.
(Get-Host).Version
$Host.Version
Through the Registry Editor
Your Registry stores all the necessary information on your programs and features, including the version number. So, you can use the Registry Editor to check out the current version of your PowerShell.
To see the version of Windows PowerShell:
- Open Run (Windows + R).
- Type
regedit
and press Enter to open the Registry Editor. - Go to
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine
- Check the value of PowerShellVersion.
- You can also use the following cmdlet on PowerShell to get the value of this Registry Entry.
(Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersion
To see the version of PowerShell Core:
- Open the Registry Editor.
- Go to
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShellCore\InstalledVersions\
- Select the key/s inside InstalledVersions and check the SemanticVersion.
- If you have multiple instances of PowerShell Core (it can happen if you install different versions through different methods), you can check the InstallLocation entry to determine which version points to which program.