Blog

This article explains how to update Windows PowerShell to version 5.1 and install or update PowerShell Core to version 7.3. Currently, there are two branches of PowerShell:

– The older Windows PowerShell (maximum version 5.1, no longer actively developed).

– The new platform PowerShell Core (version 7.3 available).

Despite the version numbering continuing from 5.1 (6.0, 6.1, 7.0, etc.), these are two distinct platforms. We will cover how to update both Windows PowerShell and PowerShell Core.

PowerShell Core 7.x is compatible with Windows PowerShell, meaning you can run older scripts and cmdlets in PowerShell Core.

You can buy genuine product keys for Windows 11 in our catalog from 11.20 €

Updating Windows PowerShell to 5.1

In all versions starting from Windows 10 and Windows Server 2016, Windows PowerShell 5.1 is installed by default.

In earlier versions (Windows 7/8.1 and Windows Server 2008 R2/2012), updating to PowerShell 5.1 requires manual installation. For example, Windows Server 2012 R2 (and Windows 8.1) comes with PowerShell 4.0.

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

1. Check the current PowerShell version:

$PSVersionTable.PSVersion

2. To update PowerShell to version 5.1, install Windows Management Framework (WMF) 5.1, which requires .NET Framework 4.5.2 or higher. Verify the installed .NET version with:

(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release).Release

3. If you have an outdated .NET version (e.g., 4.5.1), download and install .NET Framework 4.8.

4. After installing .NET 4.8 (requires a reboot), download WMF 5.1 for Windows Server 2012 R2.

5. Install the Windows Management Framework 5.1 MSU file.

6. Reboot the server, then launch powershell.exe and verify that PowerShell has been updated to version 5.1:

$PSVersionTable.PSVersion

For Windows Server 2008 R2 or Windows 7, you can update PowerShell to 5.1 similarly: first install .NET Framework 4.5.2 or higher, then install WMF 5.1.

Installing or Updating PowerShell Core 7.x

PowerShell Core is a cross-platform environment actively developed, unlike Windows PowerShell 5.1. It is installed separately from Windows PowerShell, so upgrading Windows PowerShell 5.1 to PowerShell Core is not possible.

Currently, PowerShell Core versions 6.x and 7.x are available. We recommend using the latest version of PowerShell Core (currently 7.3) unless you require compatibility with legacy scripts.

There are several ways to install or update PowerShell Core in Windows 10 and 11:

– Using the MSI installer from PowerShell’s GitHub.

– Using the WinGet package manager.

– Via the Microsoft Store.

Updating PowerShell Core Using the MSI Installer

1. Visit the PowerShell project page on GitHub and download the latest MSI installer.

2. Install the MSI file. During installation, the following options are available:

Add PowerShell to Path Environment Variable — Adds PowerShell to the system’s environment variables.

Register Windows Event Logging Manifest — Registers event logging for PowerShell.

Enable PowerShell Remoting — Enables remote management via WinRM.

Add ‘Open here’ context menu to Explorer — Adds an option to the Explorer context menu.

Add ‘Run with PowerShell 7’ context menu for PowerShell files — Adds an option to run scripts with PowerShell 7.

3. To enable automatic updates for PowerShell Core via Windows Update or WSUS, activate the relevant options.

Updating PowerShell Core Using WinGet

1. If WinGet is installed, install or update PowerShell to the latest version with:

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

2. To install a specific version of PowerShell Core, use:

winget install --id=Microsoft.PowerShell -v "7.1.2" -e

Installing PowerShell Core via MSI for SCCM/MDT/Scripts

For silent installation of PowerShell Core using MSI with SCCM/MDT/scripts, use the following parameters:

ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL
ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL
ENABLE_PSREMOTING
REGISTER_MANIFEST
ADD_PATH
DISABLE_TELEMETRY
USE_MU – Use Microsoft Update for PowerShell Core updates
ENABLE_MU – Allow PowerShell Core updates via Windows Update

Example command:

msiexec.exe /package PowerShell-7.3.3-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 ADD_PATH=1 ENABLE_MU=1 ADD_PATH=1

You can update PowerShell directly from the console by running:

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

This command downloads and installs the latest PowerShell Core MSI from GitHub.

After installation, a PowerShell Core window (pwsh.exe) will open. Verify the installed version (e.g., 7.3.3) with:

$PSVersionTable.PSVersion

Installing or Updating PowerShell Core Using WinGet

If you have the WinGet package manager installed, install or update PowerShell to the latest version with:

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

To install a specific version of PowerShell Core, run:

winget install --id=Microsoft.PowerShell -v "7.1.2" -e

Installing or Updating PowerShell Using Chocolatey

If you use the Chocolatey package manager, install or update PowerShell 5.1 with:

choco install powershell -y

choco upgrade powershell -y

For PowerShell 7.x:

choco upgrade pwsh -y

Important PowerShell Directories

Note the locations of files for different PowerShell versions:

– Windows PowerShell 5.1: $env:WINDIR\System32\WindowsPowerShell\v1.0

– PowerShell Core 6.x: $env:ProgramFiles\PowerShell\6

– PowerShell 7.x: $env:ProgramFiles\PowerShell\7

When installing PowerShell 7.3, if a 6.x version was previously installed, the $env:ProgramFiles\PowerShell\6 directory is automatically removed.

The executable file for PowerShell Core is now called pwsh.exe and is located in c:\Program Files\PowerShell\7\pwsh.exe. It has its own icon in the Start menu.

– To launch Windows PowerShell (.NET Framework-based):

powershell.exe

– To launch PowerShell Core (.NET Core-based):

pwsh.exe

Using Both PowerShell Versions

Your computer can now have both Windows PowerShell 5.1 and PowerShell Core 7.3 installed.

To check the PowerShell Core version, run:

(Get-Command 'C:\Program Files\PowerShell\7\pwsh.exe').Version

To check the PowerShell version on a remote computer:

Invoke-Command -ComputerName computer1 -Scriptblock {(Get-Command 'C:\Program Files\PowerShell\7\pwsh.exe').Version}

Running Previous PowerShell Versions

To run an older version, such as PowerShell 4, use:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 4

Updating PowerShell Core via Microsoft Store

In Windows 10 and 11, you can install PowerShell via the Microsoft Store. Find the PowerShell app manually or install it using WinGet:

winget search powershell --source msstore

winget install --id 9MZ1SNWT0N5D

The advantage of this method is that the Microsoft Store automatically tracks and installs updates as they become available.

Verify if the Store version of PowerShell Core is installed with:

Get-AppPackage Microsoft.PowerShell

In this example, the package Microsoft.PowerShell_7.3.3.0_x64__8wekyb3d8bbwe is installed.

However, a drawback is that the Store version runs in a sandboxed environment.

Installing or Updating PowerShell Core on Remote Computers

Updating PowerShell Core Using GPO

In an Active Directory domain, you can centrally install or update PowerShell Core using Group Policy (GPO):

1. Download the PowerShell MSI file and copy it to the SYSVOL directory on the domain controller.

2. Open the Group Policy Management Console (gpmc.msc), create a new policy, and assign it to an OU containing the target computers.

3. In Computer Configuration > Software Settings, create a new package and specify the path to the PowerShell MSI file in SYSVOL.

4. Reboot the computers to apply the policy. During startup, the new PowerShell version will be installed.

Updating PowerShell on Remote Computers via Command Line

Update PowerShell on remote computers from the command line using:

Invoke-Command -ComputerName dc01 -ScriptBlock {Start-Process msiexec.exe -ArgumentList '/package "\\srv1\share\PowerShell-7.3.3-win-x64.msi" /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1' -Wait}

The following script selects all active Windows 10 computers in an Active Directory domain and installs PowerShell Core on each:

$creds = $(Get-Credential)
$computers = Get-ADComputer -Filter 'operatingsystem -like "*Windows 10*" -and enabled -eq "true"'
ForEach ($computer in $computers) {
Invoke-Command -ComputerName $computer -Credential $creds {iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"}
}

The Get-ADComputer cmdlet requires the Active Directory PowerShell module to be installed on the computer.

Be cautious when using PowerShell Remoting commands (Enter-PSSession, Invoke-Command) to connect to remote computers. To connect to a PowerShell 7 endpoint, use:

Enter-PSSession -ComputerName dc01 -ConfigurationName "powershell.7"

Otherwise, you will connect to the PowerShell 5.1 endpoint.

Updating PowerShell Core via Windows Update or WSUS

Starting with version 7.2, PowerShell Core supports automatic updates via Windows Update. Enable the automatic update options during MSI installation.

The first option enables automatic PowerShell updates through any channel (sets UseMU=1 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShellCore).

The second option allows updates for all Microsoft products, not just Windows. If disabled, PowerShell updates won’t come from Microsoft Update but can still be received via WSUS/SCCM (sets registeredwithAU=1 in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\7971F918-A847-4430-9279-4A52D1EFE18D).

To check for updates, go to Settings > Update & Security > Windows Update > Advanced options and ensure Receive updates for other Microsoft products is enabled.

With this setting, PowerShell Core updates will be available via Windows Update or the PSWindowsUpdate module.

You can choose the most convenient method to update Windows PowerShell and PowerShell Core, whether using MSI packages, WinGet, Microsoft Store, or Group Policies.

banner for Windows
Buy Windows от product key from
8.00 € Find Out More
Subscribe
Notify of
guest
0 comments
Newest
Oldest
Inline Feedbacks
View all comments