Check your PowerShell version and edition
$PSVersionTable is an automatic variable — PowerShell fills it in for you, no assignment needed. It holds an object describing the running engine: its version, its edition, and the platform it runs on.
Documentation: Microsoft Learn
Meet the pipe
The | character is the pipe. It takes the objects coming out of the command on its left and feeds them as input to the command on its right — read it as "then". $PSVersionTable | Format-List PSVersion, PSEdition, OS, Platform means: take the version object, then show it as a list of just those four properties. Format-List only changes how the properties are displayed; the object itself is untouched.
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
$PSVersionTable | Format-List PSVersion, PSEdition, OS, Platform- Stage 1$PSVersionTable
Positional values or no named parameters - Stage 2Format-List
Positional values or no named parameters
Inspect a sample
Example reader
Inspect this page's example
Run supported commands against the practice data, or inspect the example without executing it.
Ready to inspect.
Show reference output
Read the engine version
PSVersion is the engine version for the current session. PSEdition distinguishes Desktop from Core. Windows PowerShell 5.1 reports Desktop; PowerShell 7 reports Core. OS and Platform are useful in modern PowerShell but are not present in every older session.
Identify the executable
Your terminal might run PowerShell 7 (pwsh.exe) while an older script still launches Windows PowerShell 5.1 (powershell.exe). If a script behaves differently than you expect, check which executable is actually running it — the window title usually names it. Changing your terminal settings does not change what an existing scheduled script uses.
Separate host, engine and module versions
$Host.Version describes the host implementation and is not the best engine-version test for every hosting application. Get-Module -ListAvailable reports installed module versions; Get-Module reports imported modules. Capture all three dimensions when reproducing a compatibility problem.
Check both editions
Launch each intended executable and run the version check inside it. Treat the sample output here as an illustration, not the current release number. Do not infer an engine version from the folder C:\Windows\System32\WindowsPowerShell\v1.0 — despite the name, that is where Windows PowerShell 5.1 lives. The "v1.0" folder name is a leftover from the very first PowerShell release and was never renamed.
Verify an automation run
If a script works when you run it by hand but fails when it runs automatically, the automatic run may be using the other PowerShell edition. Add `$PSVersionTable` output at the start of the script so the log shows which edition actually ran it, then compare with what you see in your own terminal.
Command-line reference
Show reference output
The code above is a reference for your own terminal. The sample output on this page is a stored fictional example — run the command yourself to see your real version.
Read the original documentation
Check your understanding
There is no runnable lab on this page — these run in your own terminal, so predict the answer first, then verify.
Q1. Before running it: will $PSVersionTable print a single line or a small table?
Answer: A small table of property names and values (PSVersion, PSEdition, GitCommitId, OS, Platform…). It is an object with properties, not a single string.
Q2. On PowerShell 7.4, what single value does $PSVersionTable.PSVersion.Major return?
Answer: 7 — Major is the first part of the version number.
Q3. From a CMD prompt, where.exe pwsh prints a path but where.exe powershell prints nothing. What does that tell you?
Answer: PowerShell 7 is installed and on the PATH; Windows PowerShell 5.1 is not on this machine — most likely you are on macOS or Linux, where 5.1 does not exist (it can also be removed from a Windows machine as an optional capability).
Primary documentation
Practise this
Check the installed version
Display the installed PowerShell version, as a single value.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.