Microsoft developers recently announced the release of the final version of PowerShell 7 in a blog post . It is now available for Windows, macOS, and Linux. This latest version includes new features related to support for .NET Core and new carriers.
PowerShell is optimized for automating command-line operations and provides built-in tools for processing structured data in formats such as JSON, CSV, and XML, and also supports REST APIs and object models.
In addition to the command shell, an object-oriented scripting language and a set of utilities for managing modules and scripts are offered.
Starting with the PowerShell 6 branch, the project has been developed using the .NET Core platform. By default, PowerShell transfers telemetry with the description of the operating system and the program version (to disable telemetry, you must set the environment variable POWERSHELL_TELEMETRY_OPTOUT = 1 before starting).
What's new in PowerShell 7?
In summary, PowerShell 7 integrates the following changes : migration from .Net Core version 2.x to the new version 3.1 and introduction of the ternary operators “a? b: c «, assignment and zero merge «? and ?? = «.
The .Net Core 2.xa 3.1 update introduced in this new version of PowerShell 7 allows for greater compatibility with existing PowerShell modules for Windows.
“If you haven't been able to use PowerShell Core 6.x in the past due to cross-module compatibility issues, this may be the first time that you will be able to take advantage of some of the great features we have already provided. From the beginning of the PowerShell Core project! «, Microsoft emphasizes.
He adds that:
»The PowerShell Core 6.x to 7.0 passage also marks our .NET Core 2.x to 3.1 passage.
.NET Core 3.1 brings back a large number of APIs from the .NET Framework (especially on Windows), enabling much greater compatibility with existing Windows PowerShell modules. This includes many Windows modules that require GUI functionality, such as Out-GridView and Show-Command, as well as many role management modules that come with Windows.
The full list of supported operating systems is offered as x64 variants of Windows 7, 8.1, and 10, Windows Server 2008 R2, 2012, 2012 R2, 2016, and 2019, macOS 10.13+, Red Hat Enterprise Linux (RHEL) / CentOS 7+, Fedora 29+, Debian 9+, Ubuntu 16.04+, openSUSE 15+, and Alpine Linux 3.8+.
Debian and Ubuntu ARM32 and ARM64 flavors are also supported, as is ARM64 Alpine Linux. Microsoft states that, while not officially supported, community-produced packages exist for Arch and Kali Linux. PowerShell 7 is available for download from GitHub , and installation documentation is also available for Windows, macOS, and Linux.
Microsoft is already looking ahead to PowerShell 7.1, the first preview of which will be released soon. Until then, let's return to the new features that make PowerShell 7 special:
- .NET Core 3.1 (LTS)
- Windows compatibility envelope
- new version notification
- new error view and Get-Error cmdlet
- pipe chain operators (&& and |||)
- ternary operator (a? b: c)
- null assignment and coalescence operators (??? and ?? =)
- invoke-DscResource cross-platform (experimental)
- out-GridView, -ShowWindowWindow and other GUI cmdlets are back in Windows
Finally, if you want to know more about it, you can consult the details in the following link.
How to install PowerShell 7 on Linux?
For those interested in installing this new version of PowerShell on their system, you can obtain the packages prepared for different Linux distributions from the following link.
Although you can generally install the application using Snap packages , the only requirement is that your system supports installing this type of package and has the service installed.
To perform the installation, simply open a terminal and run the following command:
snap install powershell --classic
Finally, in the case of opting for packages specially built for each distribution.
The installation can be done with your package gesture or from the terminal with dpkg (for deb packages or with rpm or dnf (for rpm packages).
For example, in the case of deb packages:
sudo dpkg -i powershell-7.0.0-1*.deb
In the case of RPM in general distributions with:
sudo rpm -i powershell-7.0.0-1*.rpm
Or in the case of Fedora or RHEL:
sudo dnf -i powershell-7.0.0-1*.rpm