Install PowerShell 7.2

PowerShell 7.2.1 adds a lot of powerful features to your PC and can coexist with older versions of PowerShell. I show you some options how to install it.

All options are alternatives, choose the one that fits best for your needs.

Install from GitHub

On this page you can always find the latest sources and installers for PowerShell: GitHub – PowerShell/PowerShell: PowerShell for every system!

You can also go to Installing PowerShell on Windows – PowerShell | Microsoft Docs and follow the instructions here. The result is the same – you download the binary, install it and that’s it.

Install with chocolatey

Chocolatey is a huge free software repository that can be used to install software. PowerShell is also available. Simply execute this command and PowerShell will be installed:

choco install pwsh -y
Code language: PowerShell (powershell)

The parameter -y forces the installation without the need of further confirmation prompts. A successful instatllation is prompted like this:

Update an existing installation

Using winget

Since Windows 10 there is a new nifty tool called winget. With winget you can search and install software commandline-based. It works similar to chocolatey:

With this command you can install PowerShell 7:

winget install PowerShell

Using older PowerShell

Some time ago I found a one-liner (unfortunately I’ve lost the original source, but Thomas Maurer wrote some additional lines about this command ) to update PowerShell via commandline:

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

Finalizing the installation

After you’ve installed the current version, you should verify the installation and install the following (if missing):

Set-ExecutionPolicy RemoteSigned
Install-PackageProvider Nuget –Force -AllowClobber
Install-Module –Name PowerShellGet –Force -AllowClobber
Update-Module -Name PowerShellGet
Code language: PowerShell (powershell)

What do you get by installing?

There are some features and functions you should know about, and they answer the question “why should I upgrade to PowerShell 7?“:

  • Pipeline-Parallelization:
ForEach-Object -Parallel
Code language: PowerShell (powershell)
  • Ternary operator to shorten if-statements: ?
$value = $true

#old-fashioned
if($value -eq $true)
{Write-Host "Yes :)"}
else
{Write-Host "No :("}

#modern ternary
$value ? "Yes :)" : "No :("
Code language: PowerShell (powershell)

The verbose version of the above can be found at the official Microsoft documentation: What’s New in PowerShell 7.0 – PowerShell | Microsoft Docs

Published by Andreas

Founder of M365 Evangelists Cloud-Architect, Strategy Consultant, Consultant for Microsoft technologies, Graph API enthusiast, PowerShell enthusiast

One comment on “Install PowerShell 7.2”

Comments are closed.