Update PowerShell to the Latest Version

by Robert Allen

In this tutorial, you will learn how to update PowerShell on Windows to the latest version. I’ll also show you how to upgrade PowerShell version 5.1 to PowerShell Core 7.

If you are new to PowerShell it can be confusing to know that there are two different versions. I’ll explain the difference and which version you should be using.

I reference the two PowerShell versions as the original PowerShell (old) and PowerShell Core (new).

PowerShell 5.1 vs PowerShell Core 7

Microsoft has created a mess in my opinion.

Microsoft released PowerShell for Windows in 2006 and it has become very popular with the Windows community. In 2016 Microsoft released a new PowerShell version that is open source and cross-platform, this version is called “PowerShell Core”. PowerShell was originally created as a scripting language for Microsoft systems. Then Microsoft makes it cross-platform because Linux doesn’t have a scripting language? Anyways, that is beyond the scope of this article.

Here are the key differences:

  • The original PowerShell is no longer being developed. Its latest version is PowerShell 5.1.
  • PowerShell 5.1 is the default version installed with Windows 10 1607 and up, Windows 11, Server 2016 and later versions.
  • The original Powershell can only be used with Windows operating systems.
  • PowerShell Core is open source and can be installed on various operating systems (Linux, osx, etc.)
  • PowerShell Core is installed separately from PowerShell 5.1 (side by side)
  • PowerShell Core uses .Net core runtime environment
  • You cannot use PowerShell ISE with PowerShell Core (insert sad emoji)
  • Visual Studio Code is recommended for development with PowerShell Core.

Update PowerShell to Version 5.1

Here are the steps for updating to the latest original PowerShell version 5.1. In this example, I have a 2012 Windows Server that comes with PowerShell version 4.0.

You can quickly check your PowerShell version with the command below:

$PSVersionTable.PSVersion

In the screenshot above you can see my server is running PowerShell version 4.

Here are the steps to upgrade to PowerShell 5.1

Step 1: Download Windows Management Framework 5.1

Click here to download WMF 5.1 from Microsoft.

Note: WMF 5.1 requires .NET Framework 4.5.2 (or above). You can install WMF 5.1 on server 2012 without .NET 4.5.2 but key PowerShell features will fail until you upgrade.

On the download page pick the install file for your operating system.

Step 2: Install and Reboot

Next, install the WMF 5.1 package. This will require a reboot.

All done. Now open PowerShell and check the version again.

$PSVersionTable

Windows 10 (1607 and up) and Windows 11 come with PowerShell 5.1 by default so no need to upgrade. Windows Server 2016 and later also come with PowerShell 5.1.

How to Upgrade to PowerShell Core 7

PowerShell Core is a different platform than the original Windows PowerShell. This means you cannot upgrade the original PowerShell to PowerShell Core 7. PowerShell Core will install separately from the original PowerShell and runs side by side.

In this example, I will install the latest version of PowerShell 7 on a Windows 10 computer. This will install alongside the original PowerShell 5.1 that is already installed with Windows 10.

Step 1: Download PowerShell Core

Download page
https://github.com/PowerShell/PowerShell

On the download page look at the right-hand side and you will see a releases section. Click on the latest release version.

Then scroll down to Assets and pick the file that matches your OS.

I’m downloading the win-x64 installer. As you can see there are installer files for other operating systems such as Linux.

Step 2: Install PowerShell Core

Next, run the installer file. It will walk you through an install wizard.

When complete you will have PowerShell Core and the original PowerShell 5.1 installed.

To check which version you have installed you will need to open them separately and run the $PSVersionTable command.

Above you can see the PowerShell Core version on the left and the original on the right.

A faster option for installing PowerShell Core is to use the Winget command.

First, search for the latest PowerShell version with the command below.

winget search Microsoft.PowerShell

Next, Install PowerShell by using the ID from the command output.

winget install --id Microsoft.Powershell --source winget

Update PowerShell Core 6.x to PowerShell 7

If you have PowerShell 6 installed, you can directly update to the latest version of PowerShell 7.

Kind of a mess hu?

Well if you have used Microsoft for very long, you know they change stuff up all the time. It can be frustrating, but there is not much you can do about it.

Update PowerShell on Multiple Computers (GPO)

Since Microsoft provides PowerShell Core as an MSI file you can use group policy to deploy it to multiple computers.

I wrote a guide on how to deploy software using group policy that includes step by step instructions and examples. It’s very easy here is a quick summary of the article.

  • Download MSI install file
  • Create a network share that is available to users. Place the MSI install file here
  • Create and link a GPO to target devices
  • Wait for GPO update on remote computers.

If you use a 3rd party product to push out updates and software packages then I’d recommend using that over group policy.

Frequently Asked Questions

Should I use Powershell 5.1 or PowerShell Core 7?

PowerShell 5.1 is still installed by default on Windows client and server operating systems. Microsoft has no plans to remove 5.1, it will be around for a long time.

Unless PowerShell 7 introduces a needed feature or fix then you should be fine sticking with 5.1. It does include several performance improvements so that might be a reason alone to upgrade.

If you want to move to PowerShell 7 then make sure you test…..test and test. Who knows what it might break, it might not be compatible with a module provided by a vendor or one you created so testing is critical. Microsoft has a module compatibility list of modules known to support PowerShell 7.

I don’t recommend upgrading every machine to 7 just to be on the latest version. I would only upgrade when needed. For personal use however, I see no problem with upgrading to PowerShell 7.

Why upgrade to PowerShell Core 7?

PowerShell 7 does include many features that are long overdue.

  • Pipeline can access multiple scripts at once – This will speed up performance
  • Built in SSH remoting – Allows you to connect to Linux based systems
  • Supports docker containers
  • Cross platform
  • Long term support
  • Secure Credential support – Securely use credentials from local or remove credential store
  • Centralized logging – This was a mess prior to PowerShell core
  • Can be updated via Windows update. – Nice but can also be dangerous

Does Windows 11 have PowerShell Core?

Yes, but the original PowerShell 5.1 is installed by default. You can use the steps in this guide to install PowerShell core on Windows 11.

There you have it. That is how you update PowerShell to the latest version.

Do you use PowerShell 7 or still use 5.1? Let me know in the comments below.

7 thoughts on “Update PowerShell to the Latest Version”

  1. MarkPrimo

    Thanks for a great tutorial. I had much success on Windows 10 but when I tried to update Server 2012R2 Powershell from 4 to 5.1, I downloaded the file and ran it, but it gets stuck on a Windows Update Standalone Installer dialog box saying “Copying packages to the Windows Update cache…”. 🤔 Also, when I run winget in PowerShell 4, I get winget is not recognized as the name of a cmdlet. And when I search for PowerShell in the Store, all I see is PowerShell Conference Asisa 2015. Gotta love Microsoft – NOT.

    Reply
    • Avatar photo
      Robert Allen

      Thanks, I have updated the article.

      Reply
  2. Tony Quinn

    Thank for the help it worked to perfection. My power shell was still the version that was released way back in 2015.

    Reply
  3. Nelson Matembissa

    Great post Robert Allen! Thanks for sharing!!!

    Reply
  4. Christer Woer

    Hi!

    Many thanks for Excellent instructions and explanation of version for Powershell. Now I will test version 7 and see if my problem with denied access to Onedrive from Powershell. It did work in Win7/10 but not in Win 11 for Powershell 5.1.

    WOW, my script did work! I have searched internet and tried a day to have it working without succes!

    Reply
    • Avatar photo
      Robert Allen

      I’ve noticed version 7 fixes some issues too. Some commands I run just freeze and do nothing but running with 7 I had no issue.

      Reply

Leave a Comment