- New Group Policy settings in Windows 11 23H2 - Mon, Nov 20 2023
- Windows Server 2025 will support SMB over QUIC in all editions - Fri, Nov 17 2023
- Switch between Windows Terminal and the legacy console - Thu, Nov 16 2023
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"
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.
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.
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.
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.
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
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
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
In my test, PowerShell 7 proved to be unstable after this installation variant and crashed regularly.
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:
For Windows:
https://github.com/PowerShell/PowerShell/blob/master/tools/install-powershell.ps1
Run it like so:
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/
I know this is a silly question but, does a person generally install the 64bit powershell on 64 bit windows? I assume yes
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.