How to update PowerShell to the latest version on Windows
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
- The original PowerShell is no longer being developed. Its latest version is PowerShell 5.1
- PowerShell 5.1 is the default version installed from Windows Server 2016 and later versions
- 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 Windows Server 2012 that comes with PowerShell version 4.0.
You can quickly check your PowerShell version with the command below:
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.
Windows Server 2016 and later will come with PowerShell 5.1 by default without updating
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 Server . This will install alongside the original PowerShell 5.1 that is already installed with Windows
Step 1: Download PowerShell Core
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.