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.

📖 4 min read📅 2026-02-10Getting Started

Installing PowerShell 7

PowerShell 7 is the latest cross-platform version. Here's how to install it on every major operating system.

Windows Installation

  1. Visit the PowerShell GitHub releases page
  2. Download the .msi file for your architecture (usually x64)
  3. Run the installer and follow the prompts

Method 2: Windows Package Manager (winget)

winget install --id Microsoft.PowerShell --source winget

Method 3: Microsoft Store

Search for "PowerShell" in the Microsoft Store and click Install.

Verify Installation

pwsh --version

You should see output like:

PowerShell 7.4.6

Note: pwsh launches PowerShell 7, while powershell launches Windows PowerShell 5.1. They can coexist side by side.

macOS Installation

# 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
pwsh

Verify Installation

pwsh --version

Linux 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
pwsh

CentOS / 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
pwsh

Arch Linux

# Install from AUR
yay -S powershell-bin

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

  1. Open VS Code
  2. Press Ctrl+Shift+X (or Cmd+Shift+X on macOS)
  3. Search for "PowerShell"
  4. 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
$PSVersionTable

Expected 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>
  • PS indicates you're in PowerShell
  • C:\Users\YourName is your current directory
  • > is the prompt where you type commands

Useful Console Shortcuts

ShortcutAction
TabAuto-complete commands and paths
Ctrl+CCancel current command
Ctrl+LClear the screen
/ Navigate command history
Ctrl+RSearch command history
F7Show 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 $PROFILE

Add 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!