Petri Newsletter Sign-up
Office 365 Insider

Here at Petri.com, we get IT — and so can you. Subscribe today to stay informed and knowledgeable regarding the latest on IT.

    See All Petri Newsletters

    How to Install PowerShell 7

    Posted on by adbertram in PowerShell

    PowerShell has come a long way from when it labeled Windows PowerShell. Nowadays, PowerShell is available on nearly every platform you can think of and supports a growing number of features and functionalities. The latest version of PowerShell, PowerShell v7, is no different.

    PowerShell 7 is Microsoft’s latest iteration of the popular scripting language. It inches closer to bringing PowerShell Core in parity with its predecessor Windows PowerShell while consistently adding new functionality.

    The PowerShell team provides a detailed breakdown of all the latest features on the PowerShell GitHub releases page.

    So you’re ready to see what PowerShell 7 can do. You’re going to have to get it installed. PowerShell 7, like previous versions of PowerShell Core, has a straightforward installation process but with some gotchas.

    PowerShell 7 Preview 3 and Windows

    As of this writing, PowerShell 7 is in preview mode and is at preview mode 3. This is the version you’re going to be installing.

    PowerShell 7 is available cross-platform. It can be installed on Windows, macOS, Linux, and others. For this article, we’re going to be focusing on getting it installed on Windows.

    Installing via GitHub

    You’ll first need to download PowerShell 7 from the PowerShell GitHub repo releases page. Since PowerShell 7 Preview 3 is the latest version available now, that’s what you’ll be installing.

    To install it manually from the GitHub repo, you can find the version you’d like to install and find the Assets section. Then, find the operating system you’d like to install it on. To install on Windows for Preview 3, the name is PowerShell-7.0.0-preview.3-win-x64.msi.

    Download this file and walk through the installation.

    Installing via Script

    If you’d like to save a bit of time, you can download and install PowerShell 7 on Windows directly from Windows PowerShell. You can, after all, install PowerShell 7 and Windows PowerShell side by side.

    To install PowerShell 7 from Windows PowerShell, you can use a PowerShell script (install-powershell.ps1) provided by Microsoft. You can download and run this script in one shot using this simple one-liner. As you can see below, this method creates a folder in your TEMP directory and download the latest version of PowerShell.

    What you don’t see is that it will run the MSI where you can run through the wizard to get it installed.

    This is, by far, the easiest way to get PowerShell 7 up and running quickly.


    Above, you used the UseMSI  and Preview  parameters. These parameters forced the script to use the pre-packaged MSI Microsoft provides. Using the Preview  parameter allows you to download preview versions of PowerShell. In this case, since PowerShell 7 is in preview, this is required.

    You can also use other optional parameters like:

    Destination  to pick the path to install to. By default, the installer will choose C:\Program Files\PowerShell\7.
    Daily  to install the bleeding edge version from the daily builds
    Quiet  to silently install PowerShell without bringing up the wizard
    DoNotOverwrite  to not overwrite the destination folder if it already exists
    AddToPath  to add the PowerShell installation folder to the user PATH environment variable

    To install PowerShell 7 at this time, only the UseMSI  and Preview  parameters are required.

    Summary

    If you haven’t yet tried out PowerShell 7 yet, I highly encourage you to do so. PowerShell 7 brings PowerShell Core ever closer to Windows PowerShell. There is still some work to be done but the PowerShell team has consistently been releasing new versions once/month and are on track to do so until PowerShell 7 becomes generally available (GA).

    Using the one-liner described in this article will allow you to easily pull down and install the latest version with minimal effort.

    BECOME A PETRI MEMBER:

    Don't have a login but want to join the conversation? Sign up for a Petri Account

    Register