If you are still launching the blue icon named “Windows PowerShell”, you are using technology from 2016.
pwsh (PowerShell 7+) is the modern, open-source, and cross-platform evolution of PowerShell. It runs on Windows, Linux, and macOS, and it’s the future of PowerShell.
This guide explains why you should be using modern PowerShell and provides a complete, step-by-step tutorial for installing it on both Windows and Linux.
Why Switch to Modern PowerShell?
- Windows PowerShell (v5.1): Built on the legacy .NET Framework. It is included with Windows but is now in maintenance mode, receiving only security fixes.
- PowerShell (v7+): Built on modern .NET. It’s open source, receives active feature updates, and is optimized for cloud and cross-platform automation.
PowerShell 7 runs side-by-side with the older Windows PowerShell, so you can safely install it without breaking legacy scripts. Key features include:
- True Cross-Platform Capability: Write one script and run it on Azure Linux VMs and Windows Desktops.
- Massive Performance Gains:
ForEach-Object -Parallelallows for multi-threaded loops. - Modern Operators: Ternary (
? :), Null coalescing (??), and pipeline chain (&&,||) operators simplify your code. - Native SSH Remoting: Manage Linux and Windows nodes securely over SSH.
Part 1: Installing PowerShell on Windows
Here are the best methods for installing pwsh on Windows 10 and 11.
The Recommended Method: Using winget
The Windows Package Manager (winget) is the fastest and most reliable way to install and update PowerShell.
Step 1: Install winget (If You Don’t Have It)
On modern versions of Windows, winget is already included. Check by opening a terminal and running winget --version. If the command is not found, the easiest way to get it is from the Microsoft Store.
- Open the Microsoft Store app.
- Search for and install “App Installer”. This package contains
winget. - Close and reopen your terminal.
winget --versionshould now work.
For offline or restricted environments, you can also download the latest .msixbundle from the winget-cli GitHub releases page and install it with Add-AppxPackage.
Step 2: Install PowerShell with winget
Once winget is available, installing PowerShell is a single command:
# Search for the package to see available versions
winget search Microsoft.PowerShell
# Install the latest stable version
winget install --id Microsoft.PowerShell --source wingetAlternative Methods for Windows
- Microsoft Store: Search for “PowerShell” in the Store and click Install. This is great for automatic background updates.
- Manual MSI Installer: For offline installations or to install a specific version, download the
PowerShell-X.X.X-win-x64.msifile from the PowerShell GitHub Releases page and run the installer.
Part 2: Installing PowerShell on Linux
PowerShell is a first-class citizen on Linux. The best way to install it is through your distribution’s native package manager.
On Debian and Ubuntu
- Add the Microsoft GPG Signing Key: This verifies the packages are from Microsoft.
# Using Ubuntu 22.04 as an example wget -q "https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb" sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb - Update and Install:
sudo apt update sudo apt install -y powershell
On RHEL, CentOS, and Fedora
- Register the Microsoft RPM Repository:
# Using RHEL 8 as an example sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm - Install:
sudo dnf install -y powershell
Universal Method: Installing with Snap
For a distribution-agnostic approach, Snap is an excellent alternative.
# The --classic flag is required for proper system access
sudo snap install powershell --classicPart 3: Post-Installation Verification
After installation on any OS, open a new terminal and type pwsh. The prompt should change to PS>.
To verify your installation and see version details, run:
$PSVersionTablePSVersion with a Major version of 7 or higher. To exit the PowerShell session and return to your standard shell, type exit.
Conclusion
Installing modern PowerShell is the first step to unlocking a new world of automation capabilities.
- On Windows, using
wingetis the recommended method for its simplicity and ease of updates. - On Linux, using your native package manager (
apt,dnf) is the most robust solution, with Snap as a great universal alternative.
With pwsh installed, you now have a consistent, powerful scripting language across your entire infrastructure. Happy scripting!