A Comprehensive Guide to Upgrading to PowerShell 7

Introduction: Why Upgrade?

When you start Windows PowerShell 5.1, you will now see the following message:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

Microsoft recommends migrating to the new PowerShell 7 for access to new features and improvements.

table of contents

Key Changes (2020-Present)

Two Versions of PowerShell

Currently, there are two types of PowerShell available in Windows:

  1. Windows PowerShell 5.1 (Legacy version)
    • Comes standard with Windows; development has ended, only security updates
    • Executable file: powershell.exe
    • Installation location: C:\Windows\System32\WindowsPowerShell\v1.0\
  2. PowerShell 7.x (Modern version)
    • Cross-platform support, actively under development
    • Executable file: pwsh.exe
    • Installation location: C:\Program Files\PowerShell\7\

Latest Version Information

  • PowerShell 7.5: Latest stable version
  • PowerShell 7.4: LTS (Long-Term Support) version
  • PowerShell 7.6-preview: Preview version (under development)

How to Check Your Current PowerShell Version

Step 1: Start Windows PowerShell

  1. Press the “Windows” key on your keyboard
  2. Type “powershell”
  3. Click on “Windows PowerShell” that appears

Step 2: Check the Version

Enter the following command and press Enter:

$PSVersionTable

Example output (Windows PowerShell 5.1):

Name                           Value
----                           -----
PSVersion                      5.1.19041.4894
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4894
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

How to Install PowerShell 7 (3 Methods)

winget is a package manager that comes standard with Windows 11 and recent Windows 10 versions.

Procedure:

Start Windows PowerShell with Administrator Privileges

  1. Type “powershell” in the start menu
  2. Right-click on “Windows PowerShell”
  3. Select “Run as administrator”

Check for Available Versions

winget search Microsoft.PowerShell

Example output:

Name               ID                           Version Source
---------------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.5.2.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.6.0.4 winget

Install PowerShell 7

To install the latest version:

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

To install a specific LTS version:

winget install --id Microsoft.PowerShell --version 7.4.11

Check the Installation Progress

  1. Downloading and installation will proceed automatically
  2. Installation is complete when “Installation was successful” is displayed

Method 2: MSI Installer (For Servers and Corporate Environments)

The MSI installer provides full control over the installation process, ideal for server and corporate environments.

Procedure:

  1. Access the GitHub Releases Page
  2. Download the Appropriate InstallerSelect according to your system:
    • 64-bit WindowsPowerShell-7.5.2-win-x64.msi
    • 32-bit WindowsPowerShell-7.5.2-win-x86.msi
    • ARM version WindowsPowerShell-7.5.2-win-arm64.msi
    If you don’t know your system’s architecture:
    1. Go to “Settings” → “System” → “About”
    2. Check “System type”
  3. Run the Downloaded MSI File
  4. Installation Wizard Stepsa. Welcome Screen
    • Click “Next”
    b. License Terms
    • Check “I accept the terms in the License Agreement”
    • Click “Next”
    c. Select Installation Destination
    • Default: C:\Program Files\PowerShell\7\
    • Click “Next” if no change is needed
    d. Optional Features (Important)Check the following options:
    • ✅ Add PowerShell to Path Environment Variable
    • ✅ Register Windows Event Logging Manifest
    • ✅ Enable PowerShell remoting
    • ✅ Add ‘Open here’ context menus to Explorer
    • ✅ Add ‘Run with PowerShell 7’ context menu for PowerShell files
    e. Start Installation
    • Click “Install”
    • If prompted for administrator privileges, select “Yes”
    f. Completion
    • Click “Finish”

Method 3: Microsoft Store (Easiest but with Limitations)

Procedure:

  1. Open the Microsoft Store
    • Start “Microsoft Store” from the start menu
  2. Search for PowerShell
    • Enter “PowerShell” in the search box
  3. Install
    • Select “PowerShell” (published by Microsoft)
    • Click “Get” or “Install”

Post-Installation Confirmation and Initial Settings

Installation Confirmation

Start the New PowerShell 7

  • Search for “pwsh” or “PowerShell 7” in the start menu
  • The one with the black background icon is PowerShell 7

Check the Version

$PSVersionTable

Example output:

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.22631
Platform                       Win64
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

If you are using Windows Terminal, you can set PowerShell 7 as the default:

  1. Open Windows Terminal Settings
    • Start Windows Terminal
    • Press “Ctrl + ,” or click the down arrow next to the tab → “Settings”
  2. Change the Default Profile
    • Navigate to “Startup” → “Default profile”
    • Select “PowerShell” (pwsh.exe) from the dropdown
    • Click “Save”

Hide the Startup Message (Optional)

If you want to hide the startup message for Windows PowerShell 5.1, you can use the -NoLogo option:

For Windows Terminal:

  1. Open settings (settings.json)
  2. Find the Windows PowerShell profile
  3. Change the command line as follows:
"commandline": "powershell.exe -NoLogo"

About the Coexistence of PowerShell 7 and 5.1

PowerShell 7 is designed to run alongside Windows PowerShell 5.1.

Points for Using Them Separately

When to use PowerShell 7:

  • Creating new scripts
  • Cross-platform support is required
  • Want to use the latest features
  • Performance is a priority

When to use Windows PowerShell 5.1:

  • Compatibility with legacy scripts is required
  • Using specific Windows management modules
  • Active Directory management, etc.

Differences in Executable Files

# Start Windows PowerShell 5.1
powershell.exe

# Start PowerShell 7
pwsh.exe

Automatic Update Settings

PowerShell 7.2 and later support Microsoft Update and can be automatically updated through Windows Update.

Enable Microsoft Update

When installing with MSI, enable the following option:

msiexec.exe /i PowerShell-7.5.2-win-x64.msi ENABLE_MU=1

Troubleshooting

Problem 1: winget Cannot Be Used

Error message:

'winget' is not recognized as an internal or external command, operable program or batch file.

Solution:

  1. Update Windows through Windows Update
  2. Install App Installer from the Microsoft Store
  3. If it still doesn’t work, use the MSI installer instead

Problem 2: Execution Policy Error

Error message:

... because running scripts is disabled on this system.

Solution:

Start PowerShell with administrator privileges and run the following:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Problem 3: Legacy Modules Don’t Work

Some Windows PowerShell-specific modules have compatibility issues.

Confirmation method:

Get-Module -ListAvailable

Solution:

  • Use Windows PowerShell 5.1 alongside PowerShell 7
  • Enable compatibility mode:
Import-Module -UseWindowsPowerShell ModuleName

Summary

Upgrading to PowerShell 7 can be done using three straightforward methods:

  1. winget (easiest and recommended)
  2. MSI installer (for corporate environments)
  3. Microsoft Store (with limitations)

PowerShell 7 offers improved performance, modern features, and cross-platform support, making the upgrade worthwhile. You can run Windows PowerShell 5.1 alongside PowerShell 7, ensuring a smooth transition.

Last updated: September 16, 2024

The following article is from 2020 and is preserved to show how the process has evolved.

When I start PowerShell on Windows, I get a message that says “Try the new cross-platform PowerShell https://aka.ms/pscore6“, so I decided to follow the URL and install the new version.

To check the current version, enter the following command.

$PSVersionTable


I’ll navigate to the URL mentioned in the message. When the page loads, there’s a blue banner in the upper right that says “Download PowerShell”. Clicking it takes you to the GitHub download page. However, I want to read the explanation first, so I’ll click the link in the middle of the page that says “Installing PowerShell on Windows”.

On the next page, click the “GitHub Releases” link in the “Download the installer package” section.

When you reach the GitHub page, skip the preview version at the top and scroll down to download the released version. Before coming to GitHub, the “Install MSI package” section on the Microsoft page specified the file name format as:

PowerShell-<version>-win-<os-arch>.msi

So I’ll download “PowerShell-7.0.3-win-x64.msi”.

Once the download is complete, run the file and follow the instructions. For the “Optional Actions” that appear during installation, I’ll leave them at their default values and proceed.

After installation completes, PowerShell 7 (x64) has been added to the start menu. The background color has changed from blue to black. The previous version remains available as well.

If you like this article, please
Follow !

Please share if you like it!
table of contents