Installing PowerShell
Step-by-step guide to installing PowerShell 7 on Windows, macOS, and Linux. Set up your development environment with VS Code and the PowerShell extension.
Installing PowerShell 7
PowerShell 7 is the latest cross-platform version. Here's how to install it on every major operating system.
Windows Installation
Method 1: MSI Installer (Recommended)
- Visit the PowerShell GitHub releases page
- Download the
.msifile for your architecture (usuallyx64) - Run the installer and follow the prompts
Method 2: Windows Package Manager (winget)
winget install --id Microsoft.PowerShell --source wingetMethod 3: Microsoft Store
Search for "PowerShell" in the Microsoft Store and click Install.
Verify Installation
pwsh --versionYou should see output like:
PowerShell 7.4.6
Note:
pwshlaunches PowerShell 7, whilepowershelllaunches Windows PowerShell 5.1. They can coexist side by side.
macOS Installation
Using Homebrew (Recommended)
# Install Homebrew if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install PowerShell
brew install --cask powershell
# Launch PowerShell
pwshVerify Installation
pwsh --versionLinux Installation
Ubuntu / Debian
# Update package list and install prerequisites
sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common
# Import the Microsoft repository GPG keys
source /etc/os-release
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
# Install PowerShell
sudo apt-get update
sudo apt-get install -y powershell
# Launch PowerShell
pwshCentOS / RHEL / Fedora
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
# Install PowerShell
sudo dnf install -y powershell
# Launch PowerShell
pwshArch Linux
# Install from AUR
yay -S powershell-binSetting Up VS Code (Recommended Editor)
Visual Studio Code with the PowerShell extension provides the best development experience:
Step 1: Install VS Code
Download VS Code from code.visualstudio.com
Step 2: Install the PowerShell Extension
- Open VS Code
- Press
Ctrl+Shift+X(orCmd+Shift+Xon macOS) - Search for "PowerShell"
- Install the official PowerShell extension by Microsoft
Step 3: Configure the Integrated Terminal
Open VS Code settings (Ctrl+,) and set:
{
"terminal.integrated.defaultProfile.windows": "PowerShell",
"powershell.powerShellDefaultVersion": "PowerShell (x64)"
}Key VS Code Features for PowerShell
- IntelliSense — Auto-completion for cmdlets, parameters, and variables
- Syntax Highlighting — Color-coded PowerShell syntax
- Integrated Terminal — Run scripts directly in the editor
- Debugging — Set breakpoints, step through code, inspect variables
- Linting — PSScriptAnalyzer integration for best practices
Your First PowerShell Command
Open PowerShell (type pwsh in your terminal) and try:
# Display a greeting
Write-Host "Hello, ShellRAG!" -ForegroundColor Green
# Get today's date
Get-Date
# See your PowerShell version
$PSVersionTableExpected output:
Hello, ShellRAG!
DayOfWeek : Monday
Year : 2026
...
Name Value
---- -----
PSVersion 7.4.6
PSEdition Core
OS Microsoft Windows 10.0.22631
Platform Win32NT
Understanding the PowerShell Console
When you open PowerShell, you'll see a prompt like:
PS C:\Users\YourName>
PSindicates you're in PowerShellC:\Users\YourNameis your current directory>is the prompt where you type commands
Useful Console Shortcuts
| Shortcut | Action |
|---|---|
Tab | Auto-complete commands and paths |
Ctrl+C | Cancel current command |
Ctrl+L | Clear the screen |
↑ / ↓ | Navigate command history |
Ctrl+R | Search command history |
F7 | Show command history window |
PowerShell Profiles
PowerShell profiles are scripts that run when PowerShell starts. They let you customize your environment:
# Check if a profile exists
Test-Path $PROFILE
# Create a profile if it doesn't exist
if (!(Test-Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
# Open your profile in VS Code
code $PROFILEAdd customizations to your profile:
# Example profile content
Write-Host "Welcome to PowerShell!" -ForegroundColor Cyan
# Custom aliases
Set-Alias -Name ll -Value Get-ChildItem
Set-Alias -Name np -Value notepad
# Custom prompt
function prompt {
$currentDir = Split-Path -Leaf (Get-Location)
Write-Host "[$currentDir]" -NoNewline -ForegroundColor Green
return " > "
}Now that PowerShell is installed and configured, let's learn about cmdlets — the building blocks of PowerShell!