Installing PowerShell 7
Windows
Windows includes Windows PowerShell 5.1 (the blue "Windows PowerShell" app). Install PowerShell 7 alongside it — they don't conflict:
winget install --id Microsoft.PowerShell --source winget
Or download the installer (.msi) from the PowerShell GitHub releases
page, or install it from the Microsoft Store. PowerShell 7 starts with
the pwsh command; Windows PowerShell 5.1 with powershell.
macOS
brew install powershell/tap/powershell
Linux
Microsoft publishes packages for Ubuntu, Debian, RHEL, and others (see
learn.microsoft.com/powershell), and there's a Snap package:
sudo snap install powershell --classic.
Check the version
# illustrative
$PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
7 6 6
Any 7.x version works for this course. Version 7.4 and 7.6 are long-term support (LTS) releases, supported for three years.
Windows PowerShell 5.1 vs PowerShell 7
| Windows PowerShell 5.1 | PowerShell 7 | |
|---|---|---|
| Platforms | Windows only | Windows, Linux, macOS |
| Built on | .NET Framework | modern .NET |
| Updates | Security fixes only | New features |
| Command | powershell |
pwsh |
Most scripts work in both, but PowerShell 7 adds features used in this
course — such as the ternary operator (? :), null-coalescing (??),
and ForEach-Object -Parallel.