Updating the PowerShell Version on Windows

This article shows you how to upgrade your version of Windows PowerShell to the latest version 5.1 and install (update) PowerShell Core 7.1. In the previous article we mentioned that there are currently two versions of PowerShell: the classic Windows PowerShell (the latest version is 5.1 and is no longer under development) and the new PowerShell Core platform (version 7.1 is available). Although the version numbering of PowerShell starts with 5.1 (6.0, 6.1, 7.0, 7.1, etc.), they are two different products. So we’ll show you how to upgrade Windows PowerShell and PowerShell Core.

Contents:

  • Upgrade to Windows PowerShell 5.1
  • How do I install or update PowerShell Core 7?

Upgrading to Windows PowerShell 5.1

Let’s try to update Windows PowerShell to version 5.1 on Windows Server 2012 R2.

By default, Windows Server 2012 R2 (Windows 8.1) is installed with PowerShell 4.0.

First check the current version of PowerShell (you can see on the screenshot that PowerShell 4.0 is installed):

$PSVersionTable.PSVersion

To upgrade to PowerShell 5.1, install the Windows Management Framework 5.1, which requires the .NET Framework 4.5.2 (or later). Use this command to ensure that .NET 4.5.2 or later is installed:

(Get-ItemProperty ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’ -Name Release).Release

In my case, version 378675 means that version 4.5.1 of the .NET Framework is installed. So I need to download and install the latest version of the .NET Framework 4.8 (here is the link to the offline installer: https://go.microsoft.com/fwlink/?linkid=2088631 – ndp48-x86-x64-allos-enu.exe).

Install .NET 4.8 (you need to restart your computer) :

If you install WMF 5.1 without .NET 4.5.2, some features of PowerShell are not available.

Download WMF 5.1 for Windows Server 2012 R2 – Win8.1AndW2K12R2-KB3191564-x64.msu (https://go.microsoft.com/fwlink/?linkid=839516).

Install the Windows 5.1 management framework.

After restarting the server, open the PS console and make sure the PowerShell version is updated to 5.1.

If you have an unsupported Windows 7 or Windows Server 2008 R2, you can upgrade PowerShell in the same way from version 2.0 to 5.1. First install the .Net Framework 4.5.2 (or later) and then the WMF 5.1 (download links are different from the links for Windows Server 2012 R2).

How do I install or update PowerShell Core 7?

Note that the latest version of Windows PowerShell installed on Windows 10 and Windows Server 2019 is PowerShell 5.1. Instead, Microsoft started developing a cross-platform version of PowerShell Core. Currently, PowerShell 6.0, 6.1, 6.2, 7.0 and 7.1 kernels are available. PowerShell Core is a new platform that is installed on your computer at the same time as Windows PowerShell. This means that you cannot upgrade PowerShell 5.1 to PowerShell Core 7.1. PowerShell 7 is installed on a computer other than Windows PowerShell 5.1.

With PowerShell 7.1, developers have added maximum compatibility with Windows PowerShell. This allows you to easily run your old PS1 scripts and commands in PowerShell Core.

If you have installed PowerShell Core 6.0, you can upgrade your computer to the latest version of PowerShell 7.1 Core (or you can install PowerShell Core 7.1 at the same time as Windows PowerShell 5.1). In this example we will try to update PowerShell Core on Windows 10 2004. There are two ways to upgrade:

  • You can manually download the MSI PowerShell Core installer from GitHub;
  • You can download and install (update) it directly from the PowerShell console.

If you would like to install PowerShell Core using the MSI package, go to the project page https://github.com/PowerShell/PowerShell and find the latest version. At the time of writing this was the case on 11. In November 2020, version 7.1.0 of PowerShell was released. An older version of PowerShell v7.2.0 is also available, but it is better to wait for a more stable version. Expand the list of assets and find the package for your version of Windows (PowerShell-7.1.0-win-x64.msi or PowerShell-7.1.0-win-x86.msi).

Download and install the MSI file.

To install PowerShell Core from the MSI package with SCCM/MDT/scripts, you can use the command with the following parameters :

msiexec.exe /package PowerShell-7.1.0-win-x86.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1

You can update PowerShell directly from the PS clip.

Let’s update (install) the latest version of PowerShell Core with the command

iex & {$(irm https://aka.ms/install-powershell.ps1)}Use method

You can also use other setting options:

  • – Purpose – Change the default installation directory of PowerShell Core.
  • -Preview – Install the latest version of PowerShell Preview.
  • -no noise -no noise
  • -AddToPath – Adds the path to the PowerShell Core installation directory to the environment variables.

This command downloads the PowerShell 7.1 MSI distribution file from GitHub and performs the installation, then runs the installation in MSI Installer.

When the installation is complete, the PowerShell Core window (pwsh.exe) will appear. Check the PowerShell version here to make sure it is PoSh 7.1.0.

If you have installed the Chocolatey package manager, you can install or update the PowerShell version with the following commands:

install choco powershell -y
update choco powershell -y

Note that the name of the executable PowerShell file has been changed. In the PowerShell kernel this is c:Program FilesPowerShell7pwshsh.exe. It has its own icon in the Start menu.

  • To run the .NET Framework on Windows PowerShell, use the command powershell.exe.
  • Use pwsh.exe to run PowerShell Core on .NET Core.

This means you have both versions on your computer: Windows PowerShell 5.1 and PowerShell Core 7.0.

Windows PowerShell offers a special backward compatibility mode that allows you to run an older version of PowerShell even if you have newer versions installed. You can run PowerShell with a specific version (e.g. 4.0) using the following command:

C:WindowsSystem32WindowsPowershellv1.0powershell.exe – Version 4

Related Tags:

powershell versions,powershell 7 ise,upgrade powershell 2 to 4,windows management framework,powershell 7 download,powershell version command,descargar powershell 64 bits,powershell 3 for windows 7 64-bit download,upgrade powershell 7,update powershell version command,powershell 7 tutorial,powershell 7 remoting,powershell windows 10 update,update powershell 7,update powershell command,run powershell 7 from command line,powershell 6.2 download,show powershell version,update powershell 7 command line,upgrade powershell 2 to 4 windows 7,upgrade powershell version 4 to 5,upgrade powershell 2 to 3 windows 2008 r2,pswindowsupdate,start-wuscan,install-windowsupdate access is denied,powershell list available windows updates,powershell install windows updates remotely,windows 2012 r2 powershell windows update,getting powershell 7,download powershell 7,powershell core auto update,powershell get updates,powershell get new version,powershell 6 portable,nettcpip powershell core,command to update powershell to latest version,how to update powershell windows 10,how to update powershell 7,latest powershell version,update powershell windows 7,update powershell 6,powershell 5.1 download