PowerShell Installation Guide
This guide provides comprehensive instructions for installing PowerShell on various operating systems. PowerShell is a powerful task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language.
Prerequisites
Before you begin, ensure your system meets the following requirements:
- A supported operating system (Windows, macOS, Linux).
- Administrator privileges for installation.
- An active internet connection to download the installer packages.
Installing PowerShell on Windows
Windows 10 and Windows Server 2019+
PowerShell 7 (the latest, cross-platform version) is available as a direct download from Microsoft. It's also included as the default by-default Windows PowerShell in newer versions of Windows.
Option 1: Using the Microsoft Store
The easiest way to install PowerShell 7 is through the Microsoft Store:
- Open the Microsoft Store app.
- Search for "PowerShell".
- Select the latest version of PowerShell and click "Get" or "Install".
Option 2: Using MSI Package
You can download the MSI installer directly from the PowerShell releases page on GitHub.
- Navigate to the GitHub releases page.
- Download the appropriate MSI installer for your Windows architecture (x64 or x86).
- Run the downloaded MSI file and follow the on-screen instructions.
Older Windows Versions (Windows 7, 8, Server 2012 R2)
For older Windows versions, you will likely install Windows PowerShell 5.1, which is included by default in many Windows releases. You can also install PowerShell Core 6.x or 7.x manually.
To install Windows PowerShell 5.1 (if not already present):
- Open PowerShell as an administrator.
- Run the command:
Install-WindowsFeature -Name PowerShell
- Follow any prompts.
Installing PowerShell on macOS
PowerShell 7 is the recommended version for macOS.
Option 1: Using Homebrew (Recommended)
If you have Homebrew installed, use the following commands:
brew install --cask powershell
Option 2: Using DMG Package
- Download the latest stable DMG package from the PowerShell releases page on GitHub.
- Double-click the DMG file to open it.
- Double-click the package installer and follow the on-screen instructions.
After installation, you can launch PowerShell by typing pwsh
in your Terminal.
Installing PowerShell on Linux
PowerShell 7 is available for various Linux distributions.
Debian/Ubuntu
Using apt repository:
# Update the list of packages
sudo apt-get update
# Install prerequisites
sudo apt-get install -y curl wget apt-transport-https software-properties-common
# Register the Microsoft package repository
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/prod $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/microsoft.list
# Update package list and install PowerShell
sudo apt-get update
sudo apt-get install -y powershell
Fedora/CentOS/RHEL
Using yum/dnf repository:
# Register the Microsoft package repository
sudo rpm -E https://packages.microsoft.com/release/2/prod.noarch.rpm | sudo tee /etc/yum.repos.d/microsoft.repo
# Update package list and install PowerShell
sudo yum update -y
sudo yum install -y powershell
pwsh
in your terminal.
Verifying Installation
To verify your installation, open your terminal or command prompt and run:
pwsh -version
This command should output the installed version of PowerShell.