Written by 3:25 pm Microsoft, Microsoft Azure, PowerShell, Thomas Maurer, Windows, Windows Server • 7 Comments

How to Install and Update PowerShell 6

Install or Update PowerShell 6 on Windows 10

Today Windows 10 and Windows Server 2019 ship with Windows PowerShell 5.1 as the default version. PowerShell Core 6 is a new edition of PowerShell that is cross-platform (Windows, macOS, and Linux), open-source, and built for heterogeneous environments and the hybrid cloud. PowerShell 6 today is a side by side version next to Windows PowerShell 5.1. That means on Windows you cannot just upgrade to PowerShell 6, you will need to install it, same as on Linux and macOS. This blog post shows you how simple you can install PowerShell 6 or update PowerShell 6, if you have already installed it, on Windows 10, Windows Server 2019 or Linux.

One great example of how cross-platform PowerShell can work, check out my blog post: How to set up PowerShell SSH Remoting

Of course, you can find excellent documentation out there on Microsoft Docs. However, Steve Lee (Microsoft Principal Software Engineer Manager in the PowerShell Team) shared some one-liner, which helps you quickly install and update PowerShell 6.

Install PowerShell Core 6

Before showing you the one-liner option to install PowerShell 6, I want to share with you the documentation to install PowerShell Core 6 on different operating systems like Windows, macOS, and Linux.

One-liner to install or update PowerShell 6 on Windows 10

Update: Since PowerShell 7 was just released, this one-liner will now install PowerShell 7.
If you want to know more about what is new in PowerShell 7, check out my blog post.

Install or Update PowerShell 6 on Windows 10

You can use this single command in Windows PowerShell to install PowerShell 7. (Update: Since PowerShell 7 was just released, this one-liner will now install PowerShell 7.)

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

There are additional parameters to for example install daily builds of the latest PowerShell previews.

-Destination
The destination path to install PowerShell Core to.

-Daily
Install PowerShell Core from the daily build.
Note that the ‘PackageManagement’ module is required to install a daily package.

-Preview
Install the latest preview.

-UseMSI
Use MSI installer.

-Quiet
Quiet command for the MSI installer.

-DoNotOverwrite
Do not overwrite the destination folder if it already exists.

-AddToPath
On Windows, add the absolute destination path to the ‘User’ scope environment variable ‘Path’;
On Linux, make the symlink ‘/usr/bin/pwsh’ points to “$Destination/pwsh”;
On MacOS, make the symlink ‘/usr/local/bin/pwsh’ points to “$Destination/pwsh”.

For more about installing PowerShell 6 on Windows, check out the Microsoft Docs.

One-liner to install or update PowerShell 6 on Linux

Install or Update PowerShell 6 on Linux

You can use this as a single command to install PowerShell 7 on Linux (Update: Since PowerShell 7 was just released, this one-liner will now install PowerShell 7.)

wget -O - https://aka.ms/install-powershell.sh | sudo bash

Depending on your distro you are using, this will register Microsoft’s pkg repos and install that package (deb or rpm).

For more about installing PowerShell 6 on Linux, or if you want to install PowerShell Core 6 on macOS, check out the Microsoft Docs.

After Installing

After you have installed PowerShell 6, also make sure to update PowerShellGet and the PackageManagement module. If you are looking about how to install and update PowerShell 7, check out my blog post.

By the way, PowerShell 6 is also used in the PowerShell version of Azure Cloud Shell. You can of course also install the Azure PowerShell module in PowerShell 6.

Tags: , , , , , , , , , , , , Last modified: March 4, 2020
Close Search Window
Close