PowerShell 7 is a new cross-platform and open-source version of PowerShell that runs side-by-side with the previous PowerShell version 5.1. This means that when you install PowerShell 7, it does not upgrade your existing version, but instead appears as its own individual application on your system.
In this tutorial, I am going to show you how you can install PowerShell 7 either directly from the command line or by downloading the MSI installer, focusing on the Windows operating system.
Overview
Being a separate application from the previous version of PowerShell (version 5.1) there is no need at this point to fully migrate to PowerShell 7.
Although, with that being said, PowerShell has many improvements over its predecessor and you may find that many scripts you previously created in the older versions of PowerShell, will run fine in PowerShell 7 and even with improved performance.
Benefits of using PowerShell 7
PowerShell 7 is easy to use and easy to install. It will also install to a separate location within your operating system meaning the changes you make within PowerShell 7 will not impact your existing installations of PowerShell. Many other benefits include:
- Improved performance
- Cross-platform
- Supports SSH remoting
- Supports use on Docker containers
- Additional features including Null operators, string highlighting and concise error views
PowerShell 7 install location
By default, PowerShell 7 is installed at the following location:
C:\Program Files\PowerShell\7
If you cannot find the PowerShell\7 folder at that location, it may be that your environment variables are not default, run the following command to check where the installation folder may be located:
get-childitem env:ProgramFiles
PowerShell 7 modules location
PowerShell 7 stores its modules in a separate location compared to previous versions of PowerShell. However both locations are combined into the PsModulePath variable, so when you import a module into PowerShell 7, it checks all PowerShell module locations, including the previous versions of PowerShell.
You can run the following command to list all the module locations used by PowerShell 7:
$Env:PSModulePath -split (';')
You results will looks like the following:
Bear in mind from the screenshot, this demonstrates that the environment variables may not be the same for everyone, below is what you may expect to see:
C:\Users \<user>\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files\SharePoint Online Management Shell\
Check which version of PowerShell you have installed
To check which version of PowerShell you have installed, open PowerShell on your workstation and type the following command: $PSVersionTable.PSVersion
You can see from the screenshot, I am running version 5.1 and I intend to install PowerShell 7.
Install PowerShell 7
Start by opening your current version of PowerShell as an administrator, then run the following command to download and install the latest version of PowerShell 7 from the official GitHub repository.
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
When the installation wizard launches, click Next.
Choose the installation folder (I recommend leaving as the default) and click Next.
Leave the Optional Actions page as default and click Next.
I recommend you leave the update options as default and then click Next.
Lastly, click Install.
Once the installation completes, close your existing PowerShell window and search for PowerShell 7 in your start menu.
Open PowerShell 7 to confirm the installation was successful.
Download the PowerShell 7 MSI installer
You can also install PowerShell 7 with the MSI installation package which can make deployment more flexible for remote or centrally managed computers.
Download the MSI package here:
64-bit: https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/PowerShell-7.3.3-win-x64.msi
32-bit: https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/PowerShell-7.3.3-win-x86.msi
Alternatively, you can check the current releases page on GitHub, select the latest version of PowerShell 7 and scroll down to the Assets sections to download the installation files.