PowerShell 7 is the common successor to Windows PowerShell and PowerShell Core. It is currently available in Preview 4, which can be installed side-by-side with other versions of PowerShell. You can run it on Windows, Linux, and macOS, each of which offers several installation options.

Since the first announcement of PowerShell 7, Microsoft has added some new features. For example, the ternary operator is a new language element modeled after C, PHP, or Javascript:

$true ? "True" : "False"
With the ternary operator, Preview 4 introduces an important linguistic innovation

With the ternary operator, Preview 4 introduces an important linguistic innovation

Multi-platform version of Out-GridView

The Out-GridView cmdlet, known from Windows PowerShell, returns in PowerShell 7, allowing you to display data graphically in tabular form.

Out GridView is now also available under Linux. It must be installed via its own module

Out GridView is now also available under Linux. It must be installed via its own module

It exists for all platforms that PowerShell 7 supports. It is currently not on board by default; instead, the installation is done with Install-Module Microsoft.PowerShell.GraphicalTools.

This blog post by Microsoft summarizes additional innovations offered in Preview 4.

Installation on Windows

You can install PowerShell 7 both alongside Windows PowerShell and in parallel with PowerShell Core. On Windows, there are two ways to do this: manually and via the command line.

For the first option, download the desired release as an MSI from Github, run the installation package, and then let the wizard guide you through the setup. On Github, you can easily overlook the download files because they are hidden in the collapsed Assets section.

The download files for PowerShell 7 are hidden in the collapsed Assets section

The download files for PowerShell 7 are hidden in the collapsed Assets section

PowerShell 7 can also be added entirely from the command line. For this, you need the PSReleaseTools PowerShell module by Jeff Hicks. This can be loaded with the command

Install-Module PSReleaseTools

which may require a new NuGet provider first. It will be set up automatically after confirmation by the user.

Installing PowerShell 7 using the PSReleaseTools module

Installing PowerShell 7 using the PSReleaseTools module

Subsequently, you can use

Install-PSPreview

to install the current preview with the default values.

Installing PowerShell 7 on Linux

On Linux, you can also add PowerShell 7 manually or from the command line. For example, in the case of Ubuntu 18.04, download the corresponding package and install it using the following command:

sudo dpkg -i powershell-preview_7.0.0-preview.4-1.ubuntu.18.04_amd64.deb

There is a good chance an error will occur when this command is executed, indicating the required libraries are not available on the system. You can use

sudo apt-get install -f

to solve this problem.

Installing PowerShell 7 manually using the Debian Package Manager

Installing PowerShell 7 manually using the Debian Package Manager

Alternatively, Microsoft provides a shell script that downloads and installs the appropriate package for each Linux distribution. This can be downloaded using the following command:

wget https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh

Afterward, make the file with

chmod 755 install-powershell.sh

and start it up by entering

sudo install-powershell.sh -preview
Installing PowerShell 7 from a shell script for Linux

Installing PowerShell 7 from a shell script for Linux

Without the "preview" switch, the script would currently install PowerShell Core 6, but will also display a wrong information about the added version. The preview of PowerShell 7 can then be started with the command

pwsh-preview
Running PowerShell 7 Preview under Ubuntu

Running PowerShell 7 Preview under Ubuntu

Another way to install Ubuntu is to use Canonical's Snap service. Microsoft also uploads its installation package there, and you can retrieve it with

Subscribe to 4sysops newsletter!

sudo snap install powershell-preview --classic
Installing PowerShell 7 from Snap

Installing PowerShell 7 from Snap

In my test, PowerShell 7 proved to be unstable after this installation variant and crashed regularly.

avatar
3 Comments
  1. Hi Wolfgang!

     

    Thank you for the good article.

     

    In the past I used the "offical" PowerShell install sripts:

    For Linux:

    https://github.com/PowerShell/PowerShell/blob/master/tools/install-powershell.sh

    Run it like so:

    wget https://aka.ms/install-powershell.sh; sudo bash install-powershell.sh -preview; rm install-powershell.sh

    For Windows:

    https://github.com/PowerShell/PowerShell/blob/master/tools/install-powershell.ps1

    Run it like so:

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

     

    The difference between the installation of the released version (6) versus the Preview (7) version is the -Preview flag.

     

    See also:

    https://www.thomasmaurer.ch/2019/07/how-to-install-and-update-powershell-7/

  2. Fred Beck 4 years ago

    I know this is a silly question but, does a person generally install the 64bit powershell on 64 bit windows?  I assume yes

  3. Yes. It's built in by default, but you can run the x64 installers (6.x, 7 previews), and it will upgrade both of them.

    David F. 

Leave a reply

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account