logo

Download and Install PowerShell 7

Introduction to PowerShell 7

PowerShell 7 is a modern, cross-platform (Windows, macOS, and Linux) automation and configuration management tool that builds on the features of Windows PowerShell. It is based on the .NET Core runtime, unlike previous versions of PowerShell that relied on the Windows-only .NET Framework. This shift has allowed for significant improvements in compatibility, performance, and versatility.

Additional features and enhancements in PowerShell 7 include:

  • PowerShell 7 introduces ForEach-Object -Parallel, allowing users to process multiple items in parallel pipelines. This significantly reduces execution times for workloads that are parallelizable.
  • New cmdlets and APIs, including updates to commands like Get-Help, make the scripting environment richer and more versatile.
  • The new -ErrorAction and -ErrorVariable options offer better control over error handling in scripts.
  • PowerShell 7 includes a Windows Compatibility Layer, which allows most modules that were built for Windows PowerShell (e.g., Active Directory or Exchange modules) to run in a Windows-based environment using implicit remoting.
  • PowerShell 7 can be installed alongside Windows PowerShell, allowing for gradual migration without disrupting existing workflows. It can run many legacy scripts with minimal modification. While not all older modules work natively, the compatibility layer ensures significant coverage.
  • PowerShell 7 integrates seamlessly with Visual Studio Code via the PowerShell extension, to include features like IntelliSense, debugging, and integrated testing.
  • Finally, PowerShell 7 is developed and maintained as an open-source project on GitHub.

To learn about differences between Windows PowerShell and PowerShell 7, see the Check, Update, and Choose a PowerShell Version article.

Active Directory Security Best Practices

We care about security of your data.

Privacy Policy

Download PowerShell 7

Before PowerShell 7 download, you must know the available versions and their differences.

Available PowerShell 7 Versions

Microsoft provides three types of releases for PowerShell 7.

Stable releases are the general availability versions of PowerShell that are considered production-ready. These versions are supported for 18 months unless they are designated as LTS.

Stable Releases

Latest Stable Release: PowerShell 7.4.6, released on October 22, 2024. This version is built on .NET 8.0 and is designated as a Long-Term Support (LTS) release, with support extending until November 2026.

LTS (Long-Term Support) Releases

LTS versions are supported for a longer period (3 years) compared to non-LTS releases. These are intended for enterprises and environments where long-term stability and compatibility are critical.

Current LTS Release: PowerShell 7.4, supported until November 2026

Preview Releases

Preview releases provide early access to new features and updates. These are intended for testing and feedback but are not recommended for production use. Once a Preview version is finalized, it becomes a Stable release.

Latest Preview Release: PowerShell 7.5 Release Candidate 1 (RC-1), announced on November 18, 2024. This version is built on .NET 9 and is considered a “go-live” release, meaning it is supported for production use. PowerShell 7.5 will follow a standard support lifecycle of 18 months.

Version Timeline and Support Summary

VersionRelease TypeSupport Ends.NET VersionNotes
7.4LTSNovember 2026.NET 8Current LTS version
7.5 RC-1PreviewN/A (Preview).NET 9Next stable candidate
7.2LTS (Ended)November 8, 2024.NET 6Previous LTS version
7.0LTS (Ended)February 2022.NET Core 3.1First LTS version

Which Version Should You Use?

  • Choose LTS for long-term stability in production environments.
  • Use Stable for access to new features while maintaining production readiness.
  • Explore Preview to test upcoming features and provide feedback.

Where to Find PowerShell 7 Download Links

You can find download links for PowerShell 7 on the Microsoft website, official PowerShell GitHub repository, and other verified sources.

Microsoft Website

URL: Install PowerShell on Windows, Linux, and macOS

Includes instructions for installing PowerShell on the following platforms:

  • Windows: MSI installers, Microsoft Store
  • macOS: .pkg files, Homebrew
  • Linux: .tar.gz files, native package managers like apt, yum, or dnf

Official PowerShell GitHub Releases Page

URL: PowerShell Releases

The GitHub releases page provides download links for:

  • Stable versions
  • LTS versions
  • Preview releases

Select the desired version and download the installer package for your operating system (Windows, macOS, Linux).

Direct Package Managers

  • Windows – Install via the Microsoft Store for automatic updates
  • macOS – Install via Homebrew
  • Linux – Use your distribution’s package manager (e.g., apt, yum, dnf, zypper)

Winget Package Manager

To install the latest version of PowerShell on a Windows system using the Windows Package Manager (winget), use this command:

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

Docker Images

URL: Docker Hub

PowerShell 7 is available as prebuilt Docker images. You can pull the latest LTS or stable release.

Installation Options for PowerShell 7

PowerShell 7 can be installed on Windows, macOS, and Linux using various methods tailored to the platform.

For Installation on Windows

  • Microsoft Store is best for users who want a simple installation process. It also provides automatic updates.
  • The MSI Installer, downloaded from the PowerShell GitHub Releases page, supports interactive installation with options to add PowerShell to the system’s PATH.
  • The Winget Package Manager is best for script-based deployments and automation.
  • The ZIP Package, downloaded from GitHub, provides a portable version of PowerShell. It is useful for environments without admin privileges or for testing.
  • Installing PowerShell as a .NET Global tool remains a good choice for .NET developers that install and use other global tools.

For Installation on macOS

  • Homebrew is recommended for macOS users due to automatic updates and integration with macOS tools.
  • The Installer Package (.pkg), downloaded from the PowerShell GitHub Releases page, provides an interactive installation experience.

For Installation on Linux

  • Install PowerShell using your distribution’s package manager, such as Ubuntu/Debian and openSUSE.
  • The Tarball Archive provides a portable installation. You can download the .tar.gz file from GitHub.

What Method is Right for You?

Choosing the right method for installing PowerShell 7 depends on the platform and your specific requirement.

EnvironmentRecommended Method
Windows DesktopMicrosoft Store or MSI Installer
Windows ServerMSI Installer or ZIP Package
macOSHomebrew or .pkg Installer
Linux (Desktop)Native Package Manager
Linux (Server)Native Package Manager or Docker
Containerized AppsDocker Images
Portable NeedsZIP Package (Windows) or Tarball (Linux/macOS)
DevelopersBuild from Source

Some additional tips are:

  • Use Microsoft Store or Homebrew for simplicity and automatic updates.
  • If you lack admin privileges, use portable versions (ZIP or Tarball).
  • Choose MSI installers for Windows or native package managers for Linux for better integration with configuration management tools.
  • Docker is ideal for isolated environments and reproducible setups, including development and testing environments.
  • Advanced users or developers contributing to PowerShell can clone the PowerShell GitHub repository and compile from source.

Install PowerShell 7 on Windows

Use the Windows Package Manager (Winget)

The Windows Package Manager (Winget) is a simple and efficient way to install PowerShell 7 on Windows. It is the recommended method to install PowerShell on Windows clients.

Prerequisites

  • Winget comes pre-installed on Windows 11 and newer versions of Windows 10. If it’s not available, install it from the App Installer package on Microsoft Store.
  • Winget can be run from Command Prompt or PowerShell.
  • Running Winget as an administrator ensures the installation proceeds without permission issues.

Steps to Install PowerShell 7 using Winget

  1. Launch either Command Prompt or PowerShell.
  2. Install the latest version of PowerShell using the package ID:

winget install –id Microsoft.PowerShell –source winget

To install a specific version, specify the –version flag:

winget install –id Microsoft.PowerShell –version 7.4.6

Install from the Microsoft Store

Installing PowerShell through the Microsoft Store offers several benefits.

  • It ensures automatic updates.
  • The installation process is seamless and integrates well with Windows.
  • It provides a trusted and secure source, reducing the risk of downloading compromised or unofficial versions.

Steps to Install PowerShell 7 through the Microsoft Store

  1. To open Microsoft Store, press Windows + S, type Microsoft Store and press Enter.
  2. In the search bar of the Microsoft Store, type PowerShell 7 and press Enter.
  3. Look for PowerShell in the search results (make sure it mentions PowerShell 7 or the latest version). To do so, scroll down to the Additional Information or App Details section and look for the version number there.
  4. Click the Get or Install button to install PowerShell. If you are not signed in to the Microsoft Store, you may need to sign in with your Microsoft account.

Install PowerShell via MSI Package

Installing PowerShell via an MSI package is particularly advantageous in enterprise setups and other environments where controlled, repeatable installations are essential. This makes it the recommended method for Windows servers and enterprise deployment scenarios.

  • An MSI package offers a centralized deployment, where IT administrators can deploy it across multiple machines using Group Policy, System Center Configuration Manager (SCCM), or other enterprise software deployment tools.
  • This also ensures that the same PowerShell version is installed consistently across all systems.
  • MSI packages allow for offline installations.
  • During installation, MSI packages offer options to configure settings like installation paths and adding PowerShell to the system path, making it easy to tailor the installation for specific needs.

Steps to Install PowerShell 7 via the MSI Package

  1. Go to the PowerShell GitHub releases page.
  2. Find the latest PowerShell 7 release and scroll down to the Assets section.
  3. Download the appropriate MSI file for your system:
  4. PowerShell-x64.msi for 64-bit systems
  5. PowerShell-x86.msi for 32-bit systems
  6. Locate the downloaded .msi file in your system (usually in the Downloads folder) and double-click it to run the installer. Follow the on-screen instructions to install PowerShell.

ZIP Package Installation

Use a ZIP archive for a custom installation of PowerShell. This method is flexible and straightforward for environments where you cannot use an installer or package manager. It is also the easiest way to r install multiple versions, and remains the recommended method for Windows Nano Server, Windows IoT, and Arm-based systems.

  1. Go to the PowerShell GitHub releases page.
  2. Find the latest PowerShell 7 release and scroll down to the Assets section.
  3. Download the appropriate ZIP package for your system:
  4. win-x64.zip for 64-bit systems
  5. win-x86.zip for 32-bit systems
  6. Navigate to the folder where you downloaded the ZIP file and extract its contents to a directory.
  7. Add PowerShell to System PATH.
  8. Open the Control Panel and navigate to System > Advanced system settings > Environment Variables.
  9. Under System Variables, find the Path variable and click Edit.
  10. Click New and add the path to the directory where you extracted PowerShell (e.g.,  C:\PowerShell\pwsh).
  11. Click OK to save and close the dialog boxes.

To run PowerShell 7, open a new Command Prompt or PowerShell window. Then type pwsh and press Enter to start PowerShell.

Install as a .NET Global tool

If you already have the .NET Core SDK installed, you can install PowerShell as a .NET Global tool.

dotnet tool install –global PowerShell

The dotnet tool installer adds $HOME\.dotnet\tools to your $env:PATH environment variable.

Command-Line Silent Installation

Silent installation of PowerShell is ideal for automated deployments in enterprise environments.

Steps to Perform a Silent Installation of PowerShell 7 via the Command Line

  1. Download the MSI Installer, as discussed in the Install PowerShell via MSI Package section.
  2. Open a Command Prompt with admin rights. For this, right-click on Command Prompt and select Run as administrator.
  3. Use the following command to install PowerShell silently:
msiexec /i PowerShell-x64.msi /quiet /norestart

Example: when the MSI is in the Downloads folder

msiexec /i "%UserProfile%\Downloads\PowerShell-x64.msi" /quiet /norestart

In this command:

  • /i specifies installation
  • /quiet runs the installer without displaying any UI
  • /norestart prevents the system from restarting automatically after installation

Advanced Command-Line Installation for Automated Deployment

For advanced command-line silent installation of PowerShell, administrators can leverage additional configuration options to facilitate automated deployments in enterprise environments. Here are some examples.

  • Specify a custom installation path using the INSTALLFOLDER property, as shown below:
    msiexec /i PowerShell-x64.msi /quiet /norestart INSTALLFOLDER=”C:\CustomPath\PowerShell7″
  • Add the context menu in file explorer, as shown below:
    msiexec /i PowerShell-x64.msi /quiet /norestart ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=true
  • Exclude PowerShell from the system PATH, as shown below:
    msiexec /i PowerShell-x64.msi /quiet /norestart DO_NOT_ADD_TO_PATH=true
  • Enable automatic updates through Windows Server Update Services (WSUS), as shown below:
    msiexec /i PowerShell-x64.msi /quiet /norestart ENABLE_MU=true
  • Create a batch file or PowerShell script for large-scale deployment.

Install PowerShell 7 on macOS

Yu can install PowerShell on macOS using the following methods:

  • Using Homebrew
  • Downloading Installer Package (.pkg)
  • Installing as a .NET Global tool
  • Using a ZIP Archive

Before installing PowerShell on macOS, let’s have a look at the installation requirements and supported macOS versions.

Supported macOS Versions

Microsoft supports PowerShell until PowerShell reaches end-of-support or the version of macOS reaches end-of-support. Currently supported versions are:

  • macOS 15 (Sequoia) x64 and Arm64
  • macOS 14 (Sonoma) x64 and Arm64
  • macOS 13 (Ventura) x64 and Arm64

Use the following command to check your macOS version:

sw_vers -productVersion

System Requirements

System requirements are as follows:

ProcessorIntel-based MacApple Silicon (M1/M2) is supported via Rosetta 2 or native ARM64 binaries (introduced in later releases of PowerShell 7)
Disk SpaceAt least 100 MB of free disk space for installation
PrerequisitesHomebrewAlternatively, use the .pkg installer from the GitHub release page
.NET RuntimePowerShell 7 relies on the cross-platform .NET Core runtime. The required runtime is bundled with the PowerShell package, so no separate installation is required.
Apple Silicon (M1/M2) ConsiderationsPowerShell supports native execution on Apple Silicon starting with PowerShell 7.2. If using an earlier version, Rosetta 2 must be installed.

Install PowerShell using Homebrew

Homebrew is a popular package manager for macOS, and it provides an easy way to install and update PowerShell.

To use Homebrew to install PowerShell, run the following command:

brew install --cask powershell

Or use the following cmdlet to install the LTS version of PowerShell:

brew install powershell/tap/powershell-lts

Download Package from GitHub

Microsoft provides a signed .pkg installer for PowerShell. Installing PowerShell using it is suitable for users who prefer a manual installation process.

  1. Go to the PowerShell GitHub releases page.
  2. Find the latest PowerShell 7 release and scroll down to the Assets section.
  3. Download the .pkg installer for macOS.
  4. Double-click the downloaded .pkg file and start installing PowerShell.

Install as a .NET Global tool

This method uses the .NET Core SDK to install PowerShell.

  1. Download and install the .NET SDK using Homebrew:
brew install --cask dotnet-sdk
  • Use the .NET Core CLI to install PowerShell as a global tool:
dotnet tool install --global PowerShell

The dotnet tool installer adds ~/.dotnet/tools to your PATH environment variable. –global installs PowerShell globally so you can access it system-wide.

Install Using a ZIP Archive

This method is less common but can be used for custom setups.

  1. Go to the PowerShell GitHub releases page.
  2. Find the latest PowerShell 7 release and scroll down to the Assets section.
  3. Download the ZIP file for macOS. It is typically named: powershell-7.x.x-osx-x64.tar.gz.
  4. Extract the ZIP file to a directory.
  5. Make the pwsh binary executable using the following command:
chmod +x ~/powershell/pwsh
  • Add the directory to your $PATH or create a symbolic link to pwsh in a directory that’s already in your $PATH:
ln -s ~/powershell/pwsh /usr/local/bin/pwsh
  • Finally, you can run PowerShell using the pwsh cmdlet.

Install PowerShell 7 on Linux

PowerShell is supported on a wide range of Linux distributions, enabling its use in diverse environments. The following table lists the officially supported distributions for installing PowerShell.

DistributionVersionsPackage TypeNotes
Ubuntu20.04, 22.04.debWidely supported and tested. Uses the official Microsoft APT repository.
Debian10, 11.debInstallable via the Microsoft APT repository.
CentOS7, 8 Stream.rpmRed Hat-derived. Available via the Microsoft YUM repository.
RHEL7, 8, 9.rpmSupported using YUM or DNF from the Microsoft repository. Requires enabling “Optional” and “Extras” repos on RHEL 7.
Fedora37, 38.rpmSupported via YUM/DNF repositories.
Alpine3.15+Binary tar.gzPowerShell for Alpine is available but may require additional steps due to differences in libraries (for example, glibc compatibility).
Arch LinuxRolling ReleaseAURSupported unofficially via the Arch User Repository (AUR).
Kali LinuxRolling Release.debInstalled via the Microsoft APT repository, similar to Debian/Ubuntu.

Standard Installation Methods for Linux

Standard methods for installing PowerShell 7 on Linux are:

  • Package Managers (APT, YUM, DNF) – For Debian/Ubuntu, use .deb packages from the Microsoft APT repository. For RHEL/CentOS/Fedora, use .rpm packages from the Microsoft YUM repository.
  • Binary Archive Installation – For distributions like Alpine Linux or custom environments, use the .tar.gz archive from the PowerShell GitHub releases.

Install via Package Managers

APT (Ubuntu/Debian)

  1. Before starting, use the following command to update your system’s package lists:
sudo apt update

sudo apt upgrade -y
  • Install the prerequisites using the command:
sudo apt install -y wget apt-transport-https software-properties-common
  • Import the Microsoft GPG key and register the repository using the following command:
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb
  • Install PowerShell using the following command:
sudo apt-get update

sudo apt-get install -y powershell

YUM/DNF (CentOS/RHEL/Fedora)

  1. Import the Microsoft GPG key and add the repository using he following command:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
  • Install PowerShel using this command:
sudo yum install -y powershell

Alpine Linux

  1. Install the required dependencies using the following command:
apk add --no-cache bash icu-libs less curl
  • Download and extract PowerShell using:
wget https://github.com/PowerShell/PowerShell/releases/download/v<version>/powershell-<version>-linux-alpine-x64.tar.gz

mkdir ~/powershell

tar -xzf powershell-<version>-linux-alpine-x64.tar.gz -C ~/powershell
  • You can then run PowerShell by navigating to the directory and executing the PowerShell binary, as shown below:
~/powershell/pwsh

Install using the Binary Archive (tar.gz)

The .tar.gz archive is portable and works on almost any Linux system.

  1. Go to the PowerShell GitHub releases page and download the tar.gz file for your architecture (x64 or ARM64). Here is an example command:
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-7.4.0-linux-x64.tar.gz
  • Extract the archive using:
mkdir ~/powershell

tar -xzf powershell-7.4.0-linux-x64.tar.gz -C ~/powershell
  • Run PowerShell using:
~/powershell/pwsh

Community and Alternate Installation Options

Some other options to install PowerShell on Linux are:

  • Docker Containers – Use the official PowerShell Docker images for Linux distributions.
  • Manual Build – For unsupported or custom distributions, PowerShell can be built from source, although this requires expertise and time.

Install using Docker

PowerShell has official Docker images published in the Microsoft Container Registry (MCR), which supports Linux distributions.

  1. Pull the PowerShell image using the following command:
docker pull mcr.microsoft.com/powershell
  • To launch an interactive PowerShell session in the container, use this command:
docker run -it mcr.microsoft.com/powershell

ARM Support for PowerShell on Linux

PowerShell supports ARM-based Linux systems, particularly ARM64 architectures. Distributions with ARM support are:

  • Ubuntu 20.04, 22.04 (ARM64)
  • Debian 11 (ARM64)
  • RHEL 8/9 (ARM64)
  • Alpine 3.15+ (ARM64)

To install PowerShell on ARM (Ubuntu example), do the following:

  1. Download the ARM64 .deb package from the PowerShell GitHub releases page using this command:
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell_7.4.0-1.deb_arm64.deb
  • Install the package using the following command:
sudo dpkg -i powershell_7.4.0-1.deb_arm64.deb

Install from Source

For unsupported or highly customized Linux environments, you can build PowerShell from the source code.

  1. Clone the PowerShell repository using the following command:
git clone https://github.com/PowerShell/PowerShell.git

cd PowerShell
  • Install dependencies (varies by distribution).
  • Build PowerShell using:
./build.sh -c Release

Here, -c Release specifies that the build configuration is “Release” (optimized for production).

  • The resulting pwsh binary will be located in the out/ directory (./out/linux-x64/).
  • To install PowerShell:
  • Create a directory for PowerShell (such as, /usr/local/bin/powershell).
sudo mkdir -p /usr/local/bin/powershell

sudo cp -r ./out/linux-x64/* /usr/local/bin/powershell/
  • Create a symbolic link to make pwsh globally accessible:
sudo ln -s /usr/local/bin/powershell/pwsh /usr/bin/pwsh

Running and Using PowerShell 7

Launch PowerShell 7

There are different ways to launch PowerShell 7 on Windows, macOS, and Linux.

On Windows

MethodSteps
Start MenuPress the Windows key or click the Start Menu.Type pwsh and press Enter.  
Run DialogPress Win + R to open the Run dialog.Type pwsh and click OK.  
Command Prompt or Windows PowerShellOpen Command Prompt (cmd) or Windows PowerShell.Type pwsh and press Enter.  
Desktop ShortcutCreate a shortcut pointing to the pwsh.exe executable (typically found in C:\Program Files\PowerShell\7\pwsh.exe).Double-click the shortcut to open PowerShell 7.  
Context MenuRight-click on an empty space in a folder while holding Shift.Select Open PowerShell window here (if configured).  
Taskbar or Start PinLocate PowerShell 7 in the Start Menu.Right-click and choose Pin to Start or Pin to Taskbar for easy access.  

On macOS

MethodSteps
TerminalOpen the built-in Terminal app.Type pwsh and press Return.  
Spotlight SearchPress Cmd + Space to open Spotlight.Type pwsh and press Return.  
FinderNavigate to the folder where PowerShell 7 is installed (for example, /usr/local/bin if installed via Homebrew).Double-click or run it from the Terminal.  
Homebrew (if installed via Homebrew)Use the command: brew list | grep powershell

On Linux

MethodSteps
TerminalOpen a terminal.Type pwsh and press Enter.  
Application MenuDepending on your desktop environment (for example, GNOME, KDE), search for “PowerShell” in the application menu.  
Desktop ShortcutCreate a desktop shortcut to the pwsh executable (typically located in /usr/bin/pwsh or /opt/microsoft/powershell/7/pwsh).  
Run CommandUse the Alt + F2 (GNOME) or Super + R (KDE) run command dialog.Type pwsh and press Enter.  
Script or Cron JobAdd pwsh to your scripts or scheduled tasks for automation.

Basic Command Usage and Tips

Here are basic command usages and tips to get you started.

Basic Command Syntax

ItemSyntax
CmdletsPowerShell uses cmdlets (pronounced “command-lets”) with the structure: Verb-Noun -ParameterName Value An example is: Set-Item -Path “C:\test.txt” -Value “Hello”  
PipelinesUse the pipe | to send the output of one cmdlet as input to another. Here is an example: Get-Process | Where-Object { $_.CPU -gt 100 }  

Basic Commands

TaskCommand
Find HelpTo get help for a cmdlet: Get-Help Get-Process
To view examples: Get-Help Get-Process -Examples
Navigate the File SystemList directory contents: Get-ChildItem
Change directory: Set-Location C:\Path
Create a new directory: New-Item -ItemType Directory -Path C:\NewFolder  
Manage FilesCreate a new file: New-Item -ItemType File -Path C:\test.txt
Read file content: Get-Content C:\test.txt
Write to a file: Set-Content -Path C:\test.txt -Value “Hello, World!”  
View System InformationCheck system processes: Get-Process View running services: Get-Service
Get system information: Get-ComputerInfo  
Scripting BasicsRun a script: .\script.ps1
Variables: $name = “PowerShell”
Write-Output “Hello, $name!”  
Package ManagementInstall a module: Install-Module -Name Az -Scope CurrentUser
Import a module: Import-Module Az
List installed modules: Get-InstalledModule  

Tips for Efficient Usage

Auto-Completion

Use the Tab key to autocomplete cmdlets, parameters, or file paths.

Aliases

PowerShell supports shortcuts for cmdlets, as shown below:

dir      # Alias for Get-ChildItem

cd       # Alias for Set-Location

cls      # Alias for Clear-Host

To view all aliases, use the following cmdlet:

Get-Alias

Comments in Scripts

  • Single-line comments are as:
# This is a comment
  • Multi-line comments are as:
<#

This is a multi-line comment

#>

Error Handling

Try-catch blocks are great for error handling. It is as:

Try {

    Get-Item "C:\nonexistent.txt"

} Catch {

    Write-Host "An error occurred: $_"

}

Output Formatting

  • Use the following cmdlet to format the output as a table:
Get-Process | Format-Table
  • Use the following cmdlet to format the output as a list:
Get-Process | Format-List

Cross-Platform Tips

  • On non-Windows systems, you can still use native shell commands like ls or cat.
  • Use pwsh -WindowsCompatibility mode to invoke certain Windows-only modules.

Keeping PowerShell 7 Up-to-Date

Update Options Based on Installation Method

Update PowerShell on Windows

You can update PowerShell using Winget, the Microsoft Store, or an MSI installer, depending on how it was originally installed.

MethodDescription
WingetWinget doesn’t automatically update installed applications, but you can manually update PowerShell.   Open PowerShell as an administrator and run the following command: winget upgrade –id Microsoft.PowerShell –source winget   Here, –source winget forces the command to only use the winget source repository when finding the PowerShell package. This ensures that the package is not sourced from other repositories you might have added to winget, such as third-party repositories or custom sources.  
Microsoft StoreOpen the Microsoft Store and type “PowerShell” in the search bar to search for PowerShell.   Select the “PowerShell” application.  If an update is available, the Update button will appear. Click it to update PowerShell.  
MSI installerDownload the appropriate MSI file for your system architecture from the PowerShell GitHub releases page.   Double-click the downloaded MSI file and follow the on-screen instructions to update PowerShell. Restart PowerShell when the update completes.  

Update PowerShell on macOS

Updating PowerShell on macOS can be done using several methods, depending on how it was originally installed.

MethodDescription
HomebrewUpdate Homebrew to ensure it has the latest package information using the following cmdlet: brew update   Run the following command to upgrade PowerShell: brew upgrade powershell  
Manual Download (GitHub)Download the .pkg file for the latest version of PowerShell from the PowerShell GitHub releases page.   Double-click the downloaded .pkg file and follow the on-screen instructions to update PowerShell.  
.NET ToolMake sure the .NET CLI is installed. Then use the following command to update PowerShell: dotnet tool update –global PowerShell  

Update PowerShell on Linux

Updating PowerShell on Linux depends on how it was installed.

MethodDescription
Package ManagerFor APT-based Systems (Ubuntu, Debian) Update the Package List: sudo apt update Update PowerShell: sudo apt upgrade powershell   For DNF-based Systems (Fedora, CentOS, RHEL) Update the Package Repository: sudo dnf check-update Update PowerShell: sudo dnf upgrade powershell  
Manual Download (GitHub)Download the latest package for PowerShell as appropriate to your Linux distribution (for example, .deb, .rpm, or binary .tar.gz) from the PowerShell GitHub releases page.   Uninstall the previous PowerShell version and then use the following cmdlets to install the new version.   For APT-based systems sudo dpkg -i powershell-<version>.deb   For DNF-based systems sudo rpm -Uvh powershell-<version>.rpm   For binary .tar.gz tar -xvf powershell-<version>.tar.gz sudo mv pwsh /usr/local/bin  

Upgrade from Older Versions

Upgrading from PowerShell 5.1 (Windows PowerShell) or PowerShell Core to the latest PowerShell 7+ version requires specific steps and considerations. For example, you should test your existing scripts to ensure they work with PowerShell 7+ and backup any custom profiles or scripts stored in $PROFILE.

Upgrade from Windows PowerShell 5.1

Windows PowerShell 5.1 cannot be directly upgraded but can coexist with PowerShell 7+.

Upgrade from PowerShell Core (6.x)

PowerShell Core can be directly upgraded to PowerShell 7+.

  1. Visit the PowerShell GitHub releases page and download the package compatible with your OS (for example, .msi for Windows, .deb for Linux).
  2. Install the new version. See the relevant section for details:
  3. Install PowerShell 7 on Windows
  4. Install PowerShell 7 on macOS
  5. Install PowerShell 7 on Linux

By default, PowerShell 7+ will replace the PowerShell Core installation if installed in the same location.

PowerShell 7 Support and Compatibility

Supported Operating Systems

PowerShell 7 is cross-platform and runs on Windows, macOS, and various Linux distributions.

Windows

Supported VersionsWindows 10 (x64 and ARM64) – Version 1607 or laterWindows 11 – All versionsWindows Server – 2012 R2 or later  
Requirements.NET Runtime – PowerShell 7 is built on .NET 6 or later. These runtimes are bundled with the PowerShell 7 installer for Windows.Disk Space – Approximately 150 MB for the base installationRAM – Minimum 1 GB; 2 GB or more is recommended  

macOS

Supported VersionsmacOS 10.13 High Sierra or later (64-bit)  
Requirements.NET Runtime – .NET 6 or later runtime is bundled with the PowerShell 7 package for macOSDisk Space – Approximately 150 MB for the installationRAM – Minimum 1 GB; 2 GB or more is recommended  

Linux

Supported DistributionsPowerShell 7 supports a wide range of Linux distributions. The most common ones are:   Debian-based (APT package manager) Ubuntu 16.04 or later (64-bit) Debian 9 or later (64-bit)   Red Hat-based (DNF/YUM package manager) CentOS 7 or later (64-bit) Red Hat Enterprise Linux (RHEL) 7 or later (64-bit) Fedora 30 or later (64-bit)   SUSE-based (Zypper package manager) openSUSE 42.3 or later (64-bit) SUSE Linux Enterprise Server (SLES) 12 SP2 or later (64-bit)   Other Alpine Linux 3.10 or later (64-bit) Arch Linux (community-maintained)  
Requirements.NET Runtime – .NET 6 or later runtime is required. It is bundled in most PowerShell 7 packages or can be installed manually.Disk Space – Approximately 150 MB for the installationRAM – Minimum 1 GB; 2 GB or more is recommended  

Cross-Platform Configuration

Supported Hardware Architecturex64ARM64 (for supported Windows and Linux distributions)  
Compatibility FeaturesWindows-specific modules (for example, Active Directory, Exchange) are supported via the compatibility module (Enable-WindowsCompatibility) on Windows.Cross-platform remoting is supported using SSH or WinRM, depending on the platform.  

Container Support

Docker ImagesOfficial PowerShell Docker images are available for Linux, Windows, and ARM-based systems.   Images are available for: Debian Ubuntu Alpine Windows Server Core  
RequirementsDocker must be installed and configured.  

Unsupported Configurations

  • PowerShell 7 is only supported on 64-bit operating systems, and not on 32-bit operating systems.
  • PowerShell 7 does not support Windows versions earlier than Windows 10.
  • macOS versions earlier than 10.13 High Sierra are unsupported.
  • Linux distributions that have reached their end-of-life status are not officially supported.

Microsoft Update Integration

PowerShell 7 updates can be managed via Microsoft Update on Windows, allowing users to receive updates automatically alongside other Windows updates.

How PowerShell 7 Updates Work via Microsoft Update

  • Microsoft Update – PowerShell 7 integrates with Microsoft Update, an optional service that provides updates for Microsoft software, including PowerShell.
  • Update Types – Updates may include new versions, bug fixes, security patches, and enhancements.
  • Frequency – Updates are released periodically based on PowerShell’s development cycle and critical security updates.

Enable Microsoft Update

Ensure that your system is configured to use Microsoft Update.

  1. Go to Windows Update and click Advanced options.
  2. For Receive updates for other Microsoft products, toggle the switch to On. This setting allows Microsoft Update to check for updates to PowerShell and other Microsoft software.

Set Up Automatic Updates

To ensure PowerShell updates are installed automatically, configure the Windows Update settings.

  1. Go to Windows Update and click Advanced options.
  2. Configure the following:
  3. Automatic Updates – Enable updates to install automatically
  4. Active Hours – Set active hours to prevent updates during working times

Troubleshooting PowerShell 7 Installation Issues

Installing PowerShell 7 on different platforms can occasionally result in errors due to a variety of environmental or dependency issues. Here is a list of common errors and their fixes across Windows, macOS, and Linux platforms.

Windows

  1. Error: Execution policy prevents installation

This error occurs because the execution policy is too restrictive. Run the following command in an elevated PowerShell session before attempting installation:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

  • Error: Cannot install due to missing prerequisites

This error occurs because .NET Core Runtime is missing. You must download and install the latest .NET Core Runtime from Microsoft’s .NET site and then proceed with the PowerShell installation.

  • Error: Installer requires administrative privileges

This error occurs due to lack of admin rights. To overcome it, right-click on the installer and choose Run as administrator.

MacOS

  1. Error: zsh: command not found: pwsh

This error occurs because PowerShell binary is not in the system’s PATH. Run the following command to resolve the issue:

echo ‘export PATH=”/usr/local/microsoft/powershell/7:$PATH”‘ >> ~/.zshrc

source ~/.zshrc

  • Error: Unable to mount the downloaded .pkg file

This error occurs because the .pkg file is corrupt. Delete this file and re-download it from the official site.

  • Error: Installation requires a newer version of macOS

This error occurs because the macOS version is too old. You will have to upgrade macOS to a version supported by PowerShell 7.

  • Error: Permission denied during installation

This error occurs due to lack of administrative privileges. Use the following command to resolve the issue:

sudo installer -pkg powershell-7.x.x.pkg -target /

Linux

  1. Error: Unable to locate package powershell

This error occurs because the Microsoft repository has not been added to your package manager. Use the following command to add it:

# Example for Ubuntu/Debian:

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update

  • Error: Missing dependencies

This error occurs because dependencies like libssl or curl are not installed. To install missing dependencies, use the following command:

# Example for Ubuntu:

sudo apt-get install -y libssl1.1 libcurl4

  • Error: Permission denied while running pwsh

This error occurs due to insufficient permissions on the binary. Run the following command to overcome the issue:

sudo chmod +x /usr/bin/pwsh

  • Error: The version of the package is not compatible with the system architecture

This error occurs because of the wrong architecture of the package downloaded, for example, x86 vs. ARM. You will have to download the correct package for your system’s architecture from the official release page.

Tips for Resolving Installation and Runtime Issues

Here are some general tips to troubleshoot and resolve installation and runtime issues with PowerShell 7 across platforms.

General Installation Tips

Verify System Requirements

  • Check that your OS version and architecture (x86, x64, ARM) support PowerShell 7.
  • Ensure you have the required dependencies installed, like .NET Core Runtime.

Download from Official Sources

Always use the official PowerShell GitHub releases page or your platform’s trusted repository to download PowerShell packages.

Check Installation Logs

For details about failures, check the logs:

  • Windows – C:\Windows\Temp or the Event Viewer
  • Linux/macOS – Terminal error messages or package manager logs

Update Package Managers

Ensure that package managers (for example, apt, yum, brew) are up to date before running installation commands.

Ensure Correct PATH Configuration

After installation, confirm that the PowerShell binary is accessible via PATH. If not, manually add it:

  • Windows – Edit environment variables to include C:\Program Files\PowerShell\7
  • Linux/macOS – Add /usr/bin/pwsh or /usr/local/bin/pwsh to your shell configuration

Use Elevated Privileges

On platforms requiring admin/superuser permissions, do the following:

  • Windows – Run as administrator
  • Linux/macOS – Use sudo for package installations

Tips for Resolving Runtime Issues

  • If PowerShell hangs or behaves oddly, skip profile scripts.
  • Ensure that PowerShell and all installed modules are up to date.
  • Temporarily remove third-party modules or scripts to identify compatibility issues.
  • Investigate system logs for detailed error messages.
  • For errors involving remote sessions or module installation, confirm internet connectivity and DNS resolution. Also check firewall rules and proxy settings.
  • Make sure that PowerShell environment variables like $PSModulePath and $env:PATH are correctly set.

Conclusion

This article discusses the different methods for installing and updating PowerShell 7 on various platforms, including Windows, macOS, and Linux. Here are some more recommendations for installing PowerShell 7 based on user needs:

For Beginners/Everyday Users

  • Windows – Install via MSI or Microsoft Store
  • macOS – Use the .pkg installer
  • Linux – Install via native package managers

For Developers/Power Users

  • Use package managers (Homebrew, apt, dnf) for efficient updates and system integration
  • For cross-platform scripts, install in consistent directories (e.g., /usr/local/bin)

For Portable Installations or when lacking admin privileges

  • Windows – Use the ZIP archive
  • Linux/macOS – Use the tarball for manual installation

For Enterprise Environments

  • Use centralized deployment tools (for example, Group Policy, SCCM) to deploy PowerShell MSI files
  • Automate installation scripts across systems

For Environments with Restricted Internet Access:

  • Download offline installers (MSI/PKG/Tarball) and distribute them locally

You can maximize PowerShell 7’s capabilities in different environments by following these guidelines:

  • Write scripts that are platform-independent using $IsWindows, $IsLinux, and $IsMacOS automatic variables. You should also store environment-specific paths in variables to avoid hardcoding.
  • Customize your $PROFILE for efficiency.
  • Use PowerShell Remoting to manage remote machines. Make sure you enable cross-platform SSH remoting.
  • Use built-in error handling as well as enable verbose logging for troubleshooting.
  • Always sign your scripts for production use.
  • PowerShell 7 excels at interacting with APIs, so use REST APIs and web requests.
  • Integrate PowerShell into automation tools like Jenkins, Azure DevOps, and GitHub Actions.
  •  Write modular scripts and reusable functions, and package them into modules.

FAQs

What is PowerShell 7?

PowerShell 7 is an open-source, cross-platform command-line shell and scripting language developed by Microsoft, designed for system automation, configuration management, and task orchestration across Windows, macOS, and Linux. Built on the .NET Core runtime, it introduces enhanced performance, improved error handling, and extensive support for modern workflows and cloud services like Azure. PowerShell 7 offers an object-oriented approach to command execution, allowing users to work with structured data instead of plain text, which sets it apart from traditional shells like Command Prompt and Bash. It includes thousands of built-in cmdlets, robust scripting capabilities, and seamless integration with APIs, REST services, and external tools.

PowerShell 7 is a powerful tool for system administrators, developers, and DevOps engineers, enabling efficient management of both local and remote systems through scripts and automation frameworks.

How do I download PowerShell 7?

PowerShell 7 can be downloaded from different sources, such as the Microsoft website, PowerShell GitHub Releases page, Winget, and Docker. See the Where to Find PowerShell 7 Download Links section for additional information.

Where does PowerShell 7 get installed?

The default installation location of PowerShell 7 depends on your operating system and the method used for installation.

OSDefault PathExecutable
WindowsDefault Installation Path (System-wide Installation via MSI or Microsoft Store): C:\Program Files\PowerShell\7\ Default for Current User (if installed without Admin Rights): %LOCALAPPDATA%\Programs\PowerShell\7\pwsh.exe
macOSDefault Installation Path when Installed via Homebrew: /usr/local/microsoft/powershell/7/   Manual PKG Installation: /usr/local/bin/pwshpwsh
LinuxUbuntu/Debian (APT Package Installation): /opt/microsoft/powershell/7/ RHEL/CentOS (YUM/DNF Installation):
/usr/bin/pwsh   Snap Installation: /snap/bin/pwsh   Portable Installation (via tar.gz): Extracted to a custom location (e.g., /opt/pwsh7/)
pwsh

You can run the following command from within PowerShell 7 to check the exact installation path:

$PSHOME

Is Microsoft PowerShell 7 free?

Yes, Microsoft PowerShell is free for both personal and commercial purposes and available under an open-source MIT License for cross-platform use on Windows, macOS, and Linux. However, enterprise support services from Microsoft may incur costs if you require dedicated support plans.

Is PowerShell the same as Command Prompt?

No, PowerShell is not the same as Command Prompt (CMD). While both are command-line interfaces (CLI) used to interact with the operating system, they are fundamentally different in terms of functionality, scripting capabilities, and design.

As a quick analogy, consider CMD: a basic calculator that is good for quick, simple tasks.  PowerShell is a scientific calculator, capable of performing complex calculations and advanced operations.

Key differences between PowerShell and Command Prompt are:

FeatureCommand Prompt (CMD)PowerShell
PurposeBasic command-line tasksAdvanced automation & scripting
LanguageDOS commands & batch scriptsPowerShell scripting (cmdlets, objects)
Object-OrientedText-Based OnlySupports .NET Objects
Scripting CapabilitiesLimitedHighly advanced & robust
Cross-PlatformWindows onlyWindows, macOS, Linux
Command SyntaxBasic commandsCmdlets (e.g., Get-Process)
Output HandlingPlain text outputStructured data (objects)
Pipeline SupportText pipeline onlyObject pipeline
ExtensibilityMinimalHighly extensible via modules

PowerShell is more powerful than CMD for the following reasons:

  • Supports Cmdlets – Pre-built commands with extensive functionality
  • Object-Based Output – Results are structured data, not just text
  • Automation Capabilities – Suitable for complex scripts and workflows
  • Cross-Platform – Available on Windows, macOS, and Linux
  • Integration with APIs and Cloud Services – Direct support for REST APIs and Azure services

PowerShell can run CMD commands, but CMD cannot run PowerShell cmdlets.

Is PowerShell 7 good or bad for Windows?

PowerShell 7 is excellent for Windows, especially for users involved in automation, system administration, and advanced scripting tasks.

  • PowerShell offers a robust scripting language with object-oriented capabilities.
  • It is great for managing Active Directory, cloud services (e.g., Azure), and Windows Servers.
  • It supports object pipelines instead of text-based outputs.
  • Thousands of community and official modules are available via PowerShell Gallery.
  • It offers integrated support for script signing, Just Enough Administration (JEA), and remoting with SSH.
  • PowerShell 7 supports most legacy Windows PowerShell scripts (5.1 and earlier).

How do I download Windows PowerShell 7?

Is PowerShell 7 worth it?

Yes, PowerShell 7 is absolutely worth it for IT professionals and system administrators, as well as developers and enthusiasts who want a powerful, versatile, and cross-platform scripting tool.

  • It works seamlessly across Windows, macOS, and Linux. Scripts can be written once and executed on multiple operating systems.
  • Unlike traditional shells like Command Prompt or Bash, PowerShell handles structured data objects instead of plain text.
  • It supports advanced scripting for task automation, configuration management, and remote management.
  • It supports integration with Azure, Docker, Kubernetes, and REST APIs.
  • It allows access to thousands of community and Microsoft-provided modules via PowerShell Gallery.
  • It has built-in support for PowerShell Remoting (SSH-based) to manage remote systems securely.

What is the difference between PowerShell 5 and PowerShell 7?

PowerShell 5 (Windows PowerShell 5.1) and PowerShell 7 are both command-line shells and scripting environments developed by Microsoft, but they differ significantly in terms of capabilities, platform support, and features. The following table lists the key differences:

FeaturePowerShell 5.1PowerShell 7
Platform SupportWindows OnlyWindows, macOS, Linux
Framework.NET Framework.NET Core (.NET 6+)
Open-SourceNoYes
Installation SourceBuilt-in with Windows OSSeparate installation
PerformanceModerateFaster and more efficient
Error HandlingStandard try/catchGet-Error for better handling
PipelinesText-based pipelinesObject-based pipelines
New CmdletsLimitedMore cmdlets, for example, ForEach-Object -Parallel
Cross-PlatformNoYes
REST API SupportLimitedNative support for APIs
SSH RemotingNoYes
Background JobsLimited SupportNative job improvements
Community ModulesLimitedAccess to latest modules
Experimental FeaturesNoYes
LTS (Long-Term Support)NoYes (LTS Releases)

Is PowerShell 7 compatible with Windows 10?

Yes, PowerShell 7 is fully compatible with Windows 10.

Microsoft designed PowerShell 7 to be backward-compatible with existing Windows PowerShell scripts (5.1) and fully functional on Windows 10 systems.

Since 2012, Jonathan Blackwell, an engineer and innovator, has provided engineering leadership that has put Netwrix GroupID at the forefront of group and user management for Active Directory and Azure AD environments. His experience in development, marketing, and sales allows Jonathan to fully understand the Identity market and how buyers think.