PowerShell Core and PowerShell

PowerShell now comes in 2 flavours: PowerShell (version 5.1) also known as Windows PowerShell & PowerShell Core (version 6.x and above). PowerShell Core is the new, open-sourced version of PowerShell that offers cross platform support for managing Linux, macOS, and Windows clients.

What is PowerShell 7?

PowerShell 7 is the latest major update to PowerShell. It is a cross-platform (Windows, Linux, and macOS) automation tool and configuration framework optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models. Microsoft has already made clear that the future of PowerShell development will be squarely aimed at PowerShell Core.

Why do I need PowerShell 7?

PowerShell 7 is built on .NET Core 3.1 and has significantly more backwards compatibility with existing Windows PowerShell modules. Among others it also supports features such as:

  • Pipeline parallelization with ForEach-Object -Parallel
  • New operators:Ternary operator: a ? b : c ; Pipeline chain operators: || and && ; Null coalescing operators: ?? and ??=
Find more details and other features at the PowerShell 7.0 release notes

How to Install/Upgrade to PowerShell 7?

Please note the newer PowerShell Core version can site side-by-side with the older PowerShell 5.1 version natively installed on modern versions of the Windows Operating System (OS). That said there are 2 ways one can install/upgrade to PowerShell 7; using the MSI Installer or from the Command Line:

  • Use the MSI Installer
    Download the MSI installer from the Releases tab on the PowerShell Github page and then execute it as any other installer
  • Command Line - Install PowerShell 7 using Windows PowerShell
    iex "& { $(irm https://aka.ms/install-PowerShell.ps1) } -UseMSI"
  • Command Line - Install PowerShell 7 on Linux
    wget https://aka.ms/install-PowerShell.sh; sudo bash install-PowerShell.sh; rm install-PowerShell.sh

Execute the command $PSVersionTable form the PowerShell terminal to validate a successful installation (or upgrade).