PS-Install

Windows


Windows Server

Use the msi package unless you have a compelling reason to use the zip package.You cannot install a later version of PowerShell on Windows 2012 unless you have WMF 4.0 or later.Downloads for WMF 4.0 are no longer available and WMF 5.1 does not seem to install without it. Consider an upgrade to Win2012 R2 or later.

Windows Client

winget search Microsoft.PowerShell

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

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

Linux

Ubuntu

sudo apt-get update

sudo apt-get install -y wget apt-transport-https software-properties-common

wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"

sudo dpkg -i packages-microsoft-prod.deb

rm packages-microsoft-prod.deb

sudo apt-get update

sudo apt-get install -y powershell

pwsh

Ubuntu (Alternative)

The apt based install method (described above) is generally the preferred approach as it simplifies updating to later versions.

Download .deb file from GitHub, then...

sudo dpkg -i powershell-lts_7.3.6-1.deb_amd64.deb

sudo apt-get install -f

To resolve missing dependencies and finish the install (if necessary)

Bibliography