Installing and the Console
PowerShell 7 is the modern, actively developed, cross-platform edition, installable via winget or an MSI on Windows, Homebrew on macOS, and apt/yum or Microsoft's package repository on Linux. It is distinct from legacy Windows PowerShell 5.1, which ships built into every Windows installation, cannot be removed, and receives only security fixes rather than new features.
Cricket analogy: Like how the ICC introduced the international T20 format that boards adopted separately alongside the century-old red-ball Test format, PowerShell 7 is a newer, actively developed edition installed alongside the legacy Windows PowerShell 5.1 that ships pre-built into every Windows box.
Choosing Your Installer
On Windows, winget install --id Microsoft.PowerShell or the official MSI both install PowerShell 7 side by side with Windows PowerShell 5.1. On macOS, brew install --cask powershell handles it in one line. On Ubuntu and other Debian-based Linux distros, you add Microsoft's package repository and then apt install powershell. Regardless of platform, the resulting executable is invoked as pwsh, distinct from the legacy powershell.exe.
Cricket analogy: Choosing winget on Windows, Homebrew on a Mac, or apt on Ubuntu to install PowerShell is like a franchise league drafting players through different regional trials - IPL auctions, county drafts, grade cricket scouting - all funneling talent into the same final XI, here the pwsh executable.
Windows PowerShell vs PowerShell 7
Installing PowerShell 7 does not remove Windows PowerShell 5.1 - the two coexist, launched by different executables (pwsh vs powershell.exe). PowerShell 7 is significantly faster, supports remoting into Linux and macOS hosts, and receives new language features, but some older Windows-only modules built against .NET Framework still only load reliably under 5.1's Windows PowerShell compatibility layer.
Cricket analogy: Windows PowerShell 5.1 is like a veteran fast bowler who only ever played on home pitches, reliable but limited, while PowerShell 7 is like a modern quick who's toured Australia, England, and India, adapting its remoting to reach Linux hosts the veteran never could.
Quick install commands: Windows - winget install --id Microsoft.PowerShell -e; macOS - brew install --cask powershell; Ubuntu/Debian - add the Microsoft package repo, then sudo apt update && sudo apt install -y powershell. Verify with pwsh --version afterward.
Working Productively in the Console
The PSReadLine module, bundled with PowerShell 7, powers tab completion (press Tab to cycle through matching cmdlet, parameter, and file names), syntax highlighting, and multi-line editing. Command history is recalled with the up arrow or searched interactively with Ctrl+R, and your $PROFILE file is a .ps1 script PowerShell runs automatically every time a new session starts, ideal for setting aliases, functions, or a custom prompt.
Cricket analogy: Tab completion in PowerShell is like a batter's muscle memory finishing a well-drilled shot before the ball fully arrives, while your $PROFILE script is like a personalized training routine a coach runs automatically before every net session.
By default, PowerShell's execution policy blocks running any script, including your own $PROFILE, if it's not signed. On a personal machine, Set-ExecutionPolicy RemoteSigned -Scope CurrentUser is the common fix - it allows locally created scripts to run while still requiring a valid signature on anything downloaded from the internet. Avoid Set-ExecutionPolicy Unrestricted on shared or production machines.
# Windows install
winget install --id Microsoft.PowerShell -e
# macOS install
# brew install --cask powershell
# Check where your profile script lives, and create it if missing
$PROFILE
if (-not (Test-Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force }
# Add a custom alias inside $PROFILE
Set-Alias gs Get-Service- PowerShell 7 (pwsh) is cross-platform and installed separately via winget, Homebrew, or apt.
- Windows PowerShell 5.1 ships built into Windows and coexists with PowerShell 7.
- PowerShell 7 is faster and can remote into Linux/macOS hosts; 5.1 cannot.
- PSReadLine provides tab completion, syntax highlighting, and command history search.
- $PROFILE is a .ps1 script that runs automatically at the start of every session.
- The default execution policy blocks unsigned scripts; RemoteSigned is a common safe relaxation.
- Avoid Unrestricted execution policy on shared or production machines.
Practice what you learned
1. What executable name is used to launch modern PowerShell 7, distinct from legacy Windows PowerShell?
2. Which module provides tab completion, syntax highlighting, and history search in the PowerShell console?
3. What is the purpose of the $PROFILE file?
4. Which execution policy setting allows locally authored scripts to run while still requiring a signature on scripts downloaded from the internet?
Was this page helpful?
You May Also Like
What Is PowerShell?
An introduction to PowerShell as Microsoft's object-oriented shell and scripting language, covering what sets it apart from traditional command-line tools.
PowerShell Syntax and Cmdlets
Master the Verb-Noun cmdlet naming convention, parameters, aliases, and the pipeline that make PowerShell commands predictable and discoverable.
Your First PowerShell Script
Write, save, and run a real .ps1 script with parameters, control flow, and functions, and understand execution policy before you run it.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics