logo

How to Update PowerShell

Each new PowerShell version introduces new features, performance enhancements, and security improvements. Upgrading empowers you to take advantage of these advancements. It also ensures compatibility with updated APIs, libraries, and frameworks and provides access to contributions from a vibrant community committed to knowledge sharing and best practices.

This article explains the differences between the traditional Windows PowerShell (v5.1) and the current PowerShell Core (v7), and details how to update PowerShell smoothly and securely.

Windows PowerShell 5.1 vs. PowerShell 7.x

Windows PowerShell 5.1, released with Windows Management Framework 5.1, is the last version of the traditional PowerShell. Based on the .NET framework. Though it is limited to Windows environments (Windows Server, Windows 10, and Windows 11), it offers a rich set of cmdlets for system management and diagnostics. While it still receives security updates through Windows Update, no new features are being developed.

Windows PowerShell 7 is the current version. It is an open-source, cross-platform framework compatible with Windows, macOS, and Linux. Built on .NET Core, it offers faster execution, new cmdlets and operators, and enhanced error handling. Plus, it receives regular updates with new features and security patches. Community contributions play a key role in its development.

Checking Your Current PowerShell Version

Using $PSVersionTable

To get detailed information about the version of PowerShell you have installed, take the following steps:

  1. Open PowerShell via the Start menu.
  2. Enter the following command:
$PSVersionTable

The output will list your PowerShell version (PSVersion) and edition (PSEdition), as shown here:

By Launching PowerShell

Simply launching PowerShell 7 will show the version installed and any available updates:

Windows PowerShell (5.1) vs PowerShell Core (7.x)

Understanding the fundamental differences between Windows PowerShell and PowerShell Core is important, especially if you are transitioning between the two versions or managing systems that require both.

Platform Compatibility

Windows PowerShell (5.1)

This version is exclusive to the Windows operating system and tightly integrated with the Windows environment. It enables you to take advantage of many native Windows features through cmdlets for managing Windows services, processes, event logs and more.

PowerShell Core (7.x)

Unlike its predecessor, PowerShell Core is designed to be cross-platform. Users can write scripts that work across Windows, macOS and Linux without needing significant modifications, making PowerShell Core a versatile tool for environments with several different operating systems.

Framework and Architecture

Windows PowerShell

Windows PowerShell is built on the .NET framework. It integrates seamlessly with other Windows components, which can be advantageous for certain administrative tasks.

PowerShell Core

PowerShell Core is built on .NET Core, which is optimized for cross-platform performance. It enables use of modern programming tools and enhancements, providing a more efficient scripting environment.

Cmdlets and Functionality

Windows PowerShell

Windows PowerShell offers a wide set of cmdlets specifically for Windows management. However, its usefulness is limited in cross-platform scenarios or certain cloud environments.

PowerShell Core

PowerShell Core provides valuable new cmdlets and features, such parallel processing of items in a pipeline. It also offers improvements in error handling and overall performance.

Feature Updates and Lifecycle

Windows PowerShell

Windows PowerShell 5.1 is the final version, so Microsoft will not deliver any more feature updates. However, it remains stable, with security fixes and critical updates provided.

PowerShell Core

PowerShell Core has an active development and release cycle. New features are regularly introduced, and updates are provided to enhance functionality and security.

How to Update PowerShell to Version 7

Updating to PowerShell version 7 can be accomplished using any of the following:

  • MSI installer
  • Windows Package Manager (Winget)
  • Microsoft Store

Option 1: Manual Update via MSI Installer

A straightforward way to update the PowerShell version is to use the MSI installer. This option is ideal for environments where you want full control over the installation process, such as on servers or in enterprise settings.

To download the latest MSI package from GitHub and install it, take these steps:

  1. Go to the official PowerShell GitHub repository (https://github.com/PowerShell/PowerShell/releases).
  2. On the Releases page, find the most recent version, which is listed at the top.
  • In the Assets section, select the correct MSI package for your system and start the download:
  • After the download is complete, double-click the MSI file to start the installation process. Use the default options or customize as needed.
  • After installation, open PowerShell and run $PSVersionTable.PSVersion to confirm that the latest version has been installed correctly.

Option 2: Using Windows Package Manager (Winget)

Another effective way to keep PowerShell updated is to use Windows Package Manager (Winget). Benefits of this option include the following:

  • Installation and upgrades can be completed in a single command, with no need to download files manually.
  • Winget can be scripted, so administrators can automate updates across multiple systems. This enhances management efficiency while ensuring consistent PowerShell instances.
  • Winget manages dependencies, ensuring that all related packages are updated along with PowerShell.

To upgrade to PowerShell 7 using Winget, take these steps:

  1. Open a command prompt or a PowerShell window. Remember, you may need to run it as an administrator for installation tasks.
  2. To see a list of available PowerShell packages, use the following command:
winget search Microsoft.Powershell
  • Then issue the following update PowerShell command:
winget install Microsoft.Powershell

If you already have PowerShell installed, this command will upgrade it to the latest version automatically.

  • Verify the version after the update process is finished:

Option 3: Microsoft Store Installation

Users who prefer a more straightforward installation experience can install PowerShell from the Microsoft Store. However, be sure to consider the following limitations:

  • Store-based installations may not always be updated immediately after new releases become available. This can mean that your installed version is lagging behind the latest one available on GitHub.
  • Certain functionalities or customization options available in the traditional MSI installer may be restricted or absent from the Microsoft Store version. This might impact advanced users who require specific configurations or settings.
  • In some enterprise environments, policies might restrict the use of the Microsoft Store, making it an impractical solution.

To upgrade to PowerShell 7 using the Microsoft Store, take these steps:

  1. Launch the Microsoft Store application from your Windows device. You can either click on the Start menu and look for Microsoft Store or click the icon pinned in the taskbar.
  • In the search bar of the Microsoft Store, type PowerShell and press Enter.

Locate the official PowerShell app from Microsoft (usually listed prominently in the search results) and click the Get button:

The Microsoft Store will handle the download and installation process for you:

  • Once installation is complete, you can launch PowerShell directly from the Microsoft Store (as shown below) or find it in the Start menu.

Considerations When Retaining PowerShell 5.1

As the final release of the classic PowerShell, Windows PowerShell 5.1 is now in a maintenance-only state. No new features or enhancements will be added; updates will be limited to security patches and critical fixes to ensure stability and protect against vulnerabilities.

Therefore, you can retain Windows PowerShell 5.1 (and run it alongside v7 as explained below). Just configure your system to receive the latest updates automatically via Windows Update: Go to Settings > Update & Security > Windows Update and make sure that Check for updates is set to Automatic.

You can also manually check for updates by clicking the Check for updates button.

Running PowerShell 7 Alongside Windows PowerShell 5.1

You can use both PowerShell 7 and Windows PowerShell 5.1 on the same system. In fact, installing PowerShell 7 will not impact existing PowerShell 5.1 applications because PowerShell 7 is installed as a separate executable (pwsh) that does not interfere with the PowerShell command.

This approach enables you to continue to use the older version for systems and scripts that rely on it, such as WMI and COM objects, while also having access to the capabilities introduced in PowerShell 7, including enhanced error handling, parallel processing, and new cmdlets. Plus, it enables users to migrate to PowerShell 7 at their own pace and enables thorough testing and validation of scripts in the new environment.

Steps for a Smooth Migration

To run both Windows PowerShell 5.1 and PowerShell 7 smoothly, take the following steps:

1. Install PowerShell 7 Alongside PowerShell 5.1

Download the latest version of PowerShell 7 from the official GitHub releases page. Install it using the MSI installer or another method detailed above. PowerShell 7 will be installed alongside any existing PowerShell versions without causing conflicts.

Verify installation by launching PowerShell 7 either from the Start menu or by typing pwsh at the command prompt.

2. Test Existing Scripts in PowerShell 7

PowerShell 7 introduces new syntax, cmdlets, and behavior changes that may cause incompatibilities with older scripts. In addition, some Windows PowerShell cmdlets and modules are not available or behave differently in PowerShell 7.

Accordingly, before migrating your scripts to PowerShell 7, run them in the new version to make sure they work as expected. Note that PowerShell 7 includes a Windows Compatibility Module that allows you to run Windows PowerShell cmdlets and modules in PowerShell 7, but some features may still have limitations.

3. Deprecate Windows PowerShell 5.1 Gradually

Gradually migrate your scripts from Windows PowerShell 5.1 to PowerShell 7. You may need to maintain both versions during the transition period. After migration, continue to monitor logs and scripts for errors or performance issues. This can help identify scripts that still rely on Windows PowerShell 5.1-specific behavior or modules.

Ensuring Successful Updates

Whenever you update to a new version of PowerShell, be sure to verify that the update was successful, that configurations are intact, and that any common issues that may arise have been addressed.

Verifying the Installed Version

To confirm that the correct version of PowerShell has been installed, run the following command:

$PSVersionTable

Checking Configurations and Profiles

After an update, it is important to check if any of your installed modules require updates or have compatibility issues with the new version. Run your existing scripts to make sure they function as intended, paying particular attention to any scripts that may use deprecated cmdlets or updated features. In addition, make sure that any custom cmdlets, aliases, or functions you added previously work as expected.

Troubleshooting Common Issues

After the update, if you encounter errors related to module loading, use these troubleshooting tips:

  • Verify that all dependencies are still intact and that the modules are compatible with the new version.
  • Check for any changes in cmdlet syntax or behaviors introduced in the new version.
  • Review the PowerShell changelog for relevant changes.
  • Ensure your user permissions and execution policies have not changed.
  • If accessing remote systems, verify that remoting settings are still appropriately configured.

Choosing the Right Version

To manage PowerShell updates effectively, it’s important to understand the differences between Long-Term Servicing (LTS) versions and Preview releases:

  • LTS versions are intended for production environments where stability and reliability are paramount, such as servers and other critical systems. These versions have a defined support lifecycle during which users can expect regular security updates and bug fixes, but few new features.
  • Preview releases enable users to test new capabilities and enhancements before they are included in the LTS version. These versions may contain bugs or incomplete features, making them less suitable for production environments. They are better suited for test or development environments where experimentation is appropriate and users are encouraged to provide feedback to Microsoft that can influence feature development and inclusion in future releases.

Conclusion

Administrators have several options for updating PowerShell. Downloading the latest MSI package from GitHub is ideal for administrators needing greater control over the installation process. Winget enables updates with a single command, making it a quick and efficient option, while installing PowerShell through the Microsoft Store provides a seamless experience with automatic updates and Windows integration.

Whatever method you choose, regular updates are essential for accessing new features, security enhancements, and bug fixes. Automating the update process is highly recommended to maintain consistency, reduce manual effort, and save time.

FAQ

How do I update PowerShell? 

You can update PowerShell using the Windows Package Manager (Winget), by downloading the latest MSI installer from the PowerShell GitHub releases page and installing it manually, or by using Microsoft Store.

Should I upgrade PowerShell 5.1 to 7?

Yes. PowerShell 5.1 now receives no new features or enhancements, just security updates. PowerShell 7 provides valuable cross-platform functionality along with a host of new capabilities and performance improvements.

What is the latest version of PowerShell?

PowerShell 7 is regularly updated, so check the PowerShell GitHub page for the most recent stable version.

Does PowerShell auto-update?

No, PowerShell does not auto-update by default. You need to either set up automated scripts to manage updates or update manually using the Windows Package Manager (Winget), the Microsoft Store, or downloads from GitHub.

What is the latest version of Windows PowerShell?

The latest version of Windows PowerShell is 5.1, which is part of Windows Management Framework 5.1. It does not receive new updates, so transitioning to PowerShell Core 7 or later is advisable for new features and improvements.

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.