logo

Download and Install PowerShell 7

PowerShell 7 is a cross-platform automation framework built on .NET Core, offering enhanced performance, parallel processing, and broad compatibility with Windows PowerShell modules. It runs on Windows, macOS, Linux, and containers, with flexible installation options such as package managers, MSI, ZIP, or Docker. Long-Term Support versions provide stability for enterprises, while preview builds enable early access to new features.

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.

Windows PowerShell Scripting Tutorial (PDF) for Beginners

We care about security of your data.

Privacy Policy

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.

Mastering Active Directory User Management

We care about security of your data.

Privacy Policy

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

Active Directory Group Management Best Practices

We care about security of your data.

Privacy Policy

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.

Netwrix Directory Manager

We care about security of your data.

Privacy Policy

FAQ

How to check PowerShell version after installation?

To check your PowerShell version, open any PowerShell console and run:

$PSVersionTable.PSVersion

This displays detailed version information including major, minor, and build numbers. For a quick version check, use:

$PSVersionTable

This shows complete system information including PowerShell edition (Desktop or Core), CLR version, and operating system details. Windows systems typically have multiple PowerShell versions installed – Windows PowerShell 5.1 comes built-in, while PowerShell 7.x must be installed separately. You can also run these commands for basic version info:

Get-Host | Select-Object Version
# or
$Host.Version

If you need to verify which executable you’re running:

# Show installation path
$PSHOME

# Locate PowerShell executables
Get-Command pwsh
Get-Command powershell

Understanding your PowerShell version is crucial for script compatibility and security – PowerShell 7.x offers better security features and cross-platform support that align with modern identity and data protection requirements.

PowerShell 7 vs Windows PowerShell: Which should I use?

PowerShell 7 is the recommended choice for new projects and environments, while Windows PowerShell 5.1 should only be used for legacy compatibility requirements. PowerShell 7 offers superior security with constrained language mode by default, better error handling, and cross-platform compatibility across Windows, macOS, and Linux. It runs on .NET Core/5+ providing better performance and modern programming features compared to Windows PowerShell’s .NET Framework foundation. For enterprise environments, PowerShell 7 provides enhanced security capabilities including improved execution policies, better module isolation, and more granular access controls that support identity-based security models. However, some legacy modules and cmdlets designed for Windows PowerShell may not work in PowerShell 7, particularly older Exchange, SharePoint, or custom organizational modules. The solution is to install both versions side-by-side – use PowerShell 7 for new development and automation while keeping Windows PowerShell 5.1 available for legacy scripts. Microsoft’s long-term strategy focuses entirely on PowerShell 7+, making it the smart choice for future-proofing your automation and security tooling.

How to fix ‘PowerShell has stopped working’ error?

The “PowerShell has stopped working” error typically stems from corrupted user profiles, conflicting modules, or execution policy restrictions that prevent PowerShell from starting properly. Start by opening PowerShell with the -NoProfile parameter to bypass user profile loading:

powershell -NoProfile
# or
pwsh -NoProfile

Run this from Command Prompt or the Run dialog. If this works, the issue lies in your PowerShell profile. Rebuild it by running:

New-Item -Path $PROFILE -ItemType File -Force

Then gradually re-add customizations. For persistent crashes, clear the PowerShell module cache by deleting contents from:

$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\ModuleCache

Then restart PowerShell to rebuild the cache. Check Windows Event Viewer under Applications and Services Logs > Microsoft > Windows > PowerShell for specific error details that point to problematic modules or scripts. If the error occurs during script execution, verify execution policy settings:

Get-ExecutionPolicy -List

Ensure your scripts are properly digitally signed or adjust policies appropriately. Sometimes corrupted .NET Framework installations cause PowerShell crashes – running Windows Update or repairing .NET can resolve these issues. The key is systematic troubleshooting: start with minimal configuration and gradually add components back until you identify the root cause.

PowerShell installation troubleshooting guide for common errors?

PowerShell installation failures usually involve permissions, network connectivity, or system configuration conflicts that can be systematically diagnosed and resolved. The most common error is insufficient administrative privileges – always run installation from an elevated command prompt or PowerShell session when installing via MSI packages or package managers like Chocolatey. Network-related failures often occur in corporate environments with proxy servers. Configure PowerShell to use your organization’s proxy:

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Run this before attempting installation. For Windows machines experiencing “installer package corrupt” errors, download a fresh copy of the MSI file and verify its digital signature matches Microsoft’s certificate. Linux and macOS installations may fail due to missing dependencies – ensure curl, wget, and package managers have necessary permissions and network access. If installation hangs or appears stuck, check available disk space (PowerShell requires 500MB+ free space) and temporarily disable antivirus software that might be scanning installation files in real-time. For air-gapped environments, download offline installation packages and all dependencies manually, then transfer via approved media. Document all error messages and system specifications when seeking help – specific error codes and environment details are essential for effective troubleshooting.

How to install PowerShell modules after installation?

Installing PowerShell modules requires understanding the PowerShell Gallery ecosystem and your organization’s security policies for code execution and module sources. The primary method uses Install-Module with the module name:

# Example: Install Azure PowerShell modules
Install-Module -Name Az

By default, PowerShell installs modules from the PowerShell Gallery (PSGallery), but you may need to trust this repository first:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

For enterprise environments:

# Install for current user only (no admin required)
Install-Module -Name ModuleName -Scope CurrentUser

# Install for all users (requires admin rights)
Install-Module -Name ModuleName -Scope AllUsers

Always verify module authenticity after installation:

Get-Module -ListAvailable

Check digital signatures for security-sensitive modules. Some critical modules like Active Directory (RSAT-AD-PowerShell) require Windows Feature installation rather than PowerShell Gallery installation. For organizations with restricted internet access, establish internal PowerShell repositories or download modules manually for offline installation. Security best practice dictates reviewing module source code and permissions before installation, especially for modules that will access sensitive identity or data systems. Remember that module management is a crucial component of maintaining secure PowerShell environments – treat module installation with the same security rigor you apply to any software deployment in your infrastructure.

With more than two decades in the software security industry, Tyler Reese is intimately familiar with the rapidly evolving identity and security challenges that businesses face today. Currently, he serves as the product director for the Netwrix Identity and Access Management portfolio, where his responsibilities include evaluating market trends, setting the direction for the IAM product line, and, ultimately, meeting end-user needs. His professional experience ranges from IAM consultation for Fortune 500 companies to working as an enterprise architect of a large direct-to-consumer company. He currently holds the CISSP certification.