To check your PowerShell version, run this in any PowerShell window:
$PSVersionTable.PSVersion
It returns the version of the PowerShell you are typing into. On Windows that is Windows PowerShell 5.1 unless you have opened PowerShell 7, which installs separately and runs as pwsh.
5.1 and 7 Side by Side
The same command in both shells on the same Windows 11 machine. Windows PowerShell 5.1:
Major Minor Build Revision ----- ----- ----- -------- 5 1 26100 9818
PowerShell 7:
Major Minor Patch PreReleaseLabel BuildLabel ----- ----- ----- --------------- ---------- 7 7 0
The columns differ because 7 uses semantic versioning. The rest of the differences that matter:
| Windows PowerShell 5.1 | PowerShell 7 | |
|---|---|---|
| Executable | powershell.exe | pwsh.exe |
$PSVersionTable.PSEdition | Desktop | Core |
| How you get it | Ships with Windows | Installed separately |
| New features | None, fixes only | Yes, with each release |
The two install side by side, and installing 7 does not remove or replace 5.1. So the answer to “which version am I on” depends on which one you launched.
The Full Table: $PSVersionTable
# the full table $PSVersionTable # just the major version, which is what scripts usually check $PSVersionTable.PSVersion.Major

In this example, the system is running PowerShell 7.7.0, the Core edition, and $PSVersionTable.PSVersion.Major returns 7.
Why Not $host.Version
$host.Version reports the version of the host program running PowerShell, not the PowerShell engine. In a plain console window the two match, which is why it looks right. In another host, such as the ISE or an editor’s integrated terminal, it can report that program’s own version instead. $PSVersionTable.PSVersion is always the engine.
Check the Version From Command Prompt
powershell -NoProfile -Command "$PSVersionTable.PSVersion" pwsh -NoProfile -Command "$PSVersionTable.PSVersion"
The first line asks Windows PowerShell 5.1, the second asks PowerShell 7. If pwsh is not recognised, PowerShell 7 is not installed.
Check the Version Inside a Script
# guard a script that needs PowerShell 7 features
if ($PSVersionTable.PSVersion.Major -lt 7) {
throw "This script needs PowerShell 7 or later. Current: $($PSVersionTable.PSVersion)"
}
# or declare it at the top of the script
#Requires -Version 7.0#Requires is the tidier option: PowerShell refuses to run the script at all rather than failing partway through.
Check Remote Machines
Invoke-Command -ComputerName 'APPSRV01','APPSRV02' -ScriptBlock {
$PSVersionTable.PSVersion
} | Select-Object PSComputerName, Major, MinorUseful before rolling a script out to an estate: 5.1 is on every Windows machine, but 7 is only where someone installed it. This needs PowerShell remoting enabled on the targets, and it connects to the default endpoint, which is Windows PowerShell 5.1, so expect 5.1 back even on servers that also have 7.
Upgrading to PowerShell 7
Windows PowerShell 5.1 is the last version built into Windows. For 7, see Install PowerShell 7 on Windows and Keep Windows PowerShell 5.1, and check Microsoft’s supported versions of Windows before rolling it out across several hosts.
If a script works in one version and fails in the other, paste the error into Claude Code and ask which version it expects. That’s what it’s there for.
Frequently Asked Questions
What is the quickest way to check my PowerShell version?
Run $PSVersionTable.PSVersion. For just the major number, $PSVersionTable.PSVersion.Major.
Why does it say 5.1 when I installed PowerShell 7?
You opened Windows PowerShell, powershell.exe. PowerShell 7 is a separate program: start pwsh, or pick the PowerShell 7 profile in Windows Terminal, and run the check again.
What do Desktop and Core mean in PSEdition?
Desktop is Windows PowerShell 5.1 and earlier, built on .NET Framework. Core is PowerShell 6 and 7, built on modern .NET and also available on Linux and macOS.
Should I uninstall Windows PowerShell 5.1?
No. It is part of Windows, and some modules and admin tools still expect it. Keep both and use 7 for new work.
Related
If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.
Leave a Reply