Check Your PowerShell Version ($PSVersionTable)

See which PowerShell version and edition is running before running version-sensitive scripts.

WindowsdeveloperpowershellversionLow risk
Run $PSVersionTable.PSVersion — 5.1 is the built-in Windows PowerShell, 7.x is the newer cross-platform PowerShell.

01Command

Command
$ $PSVersionTable.PSVersion

02What it does

$PSVersionTable is an automatic variable whose PSVersion field shows the engine version, and the Edition field distinguishes Desktop (Windows PowerShell 5.1) from Core (PowerShell 7+). Some modules only run on one edition, so checking first avoids confusing compatibility errors. To try PowerShell 7 without replacing 5.1, install it side by side with winget install --id Microsoft.PowerShell.

03Risk

RiskLow risk
!Warning: Opening the wrong shortcut matters: "Windows PowerShell" launches 5.1, while "PowerShell 7" (pwsh) launches the newer engine.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • about_Automatic_Variables
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents $PSVersionTable, the automatic hashtable containing PSVersion, Edition (Desktop/Core) and platform details of the running engine.
  • about_PowerShell_Editions
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Explains the Desktop edition (Windows PowerShell 5.1) versus Core edition (PowerShell 7+) and their module compatibility differences.

Last verified: 2026-09-18 · Category: Developer

06Related solutions