What's New in PowerShell 7.1

The latest versions of PowerShell are not included out-of-the-box with Windows 10. So, you might not know that PowerShell is already on version 7.1 The version in Windows 10 is called Windows PowerShell 5.1 and it is no longer being developed. But it is still supported by Microsoft. PowerShell versions 6 and later are cross-platform, and work on Windows, macOS, and Linux.

PowerShell 7.1 was released late in 2020. It builds on PowerShell 7.0 and it fixes issues reported by users. There are also a few improvements. PowerShell 7.0 was released in March 2022 and it came with several new features:

  • Pipeline parallelization with ForEach-Object -Parallel
  • New operators:
    • Ternary operator: a ? b : c
    • Pipeline chain operators: || and &&
    • Null conditional operators: ?? and ??=
  • A simplified and dynamic error view and Get-Error cmdlet for easier investigation of errors
  • A compatibility layer that enables users to import modules in an implicit Windows PowerShell session
  • Automatic new version notifications
  • The ability to invoke DSC resources directly from PowerShell 7 (experimental)

PowerShell 7.1 is based on .NET Core 5.0

This release of PowerShell is based on .NET Core 5.0. PowerShell 7.0 was based on .NET Core 3.1. PowerShell 7.1 is part of the Stable release branch and it is also the first version to be published in the Microsoft Store. When you install PowerShell from the Store, Windows 10 automatically keeps PowerShell up to date. If you’d prefer to install PowerShell 7.1 using a downloaded install package, check out Microsoft’s instructions for installing PowerShell on Windows, macOS, and Linux.

But because Store apps are restricted by design in Windows 10, you can’t establish PowerShell Remoting sessions using WSMAN to Store-based installs of PowerShell. However, SSH remote sessions are supported.

Image # Expand
What’s New in PowerShell 7.1 (Image Credit: Russell Smith)

PSReadLine 2.1.0

Tab completion lets you start typing a command and then by pressing the TAB key, have the rest of the command completed for you. But because of the sheer number of available PowerShell cmdlets, tab completion has become less effective.

The PSReadLine module adds Predictive Intellisense, which uses the history of cmdlets you typed to predict what command you want to use. In PowerShell 7.0, you needed to download the PSReadLine module manually. PSReadLine is now included in PowerShell 7.1.

Experimental features

PSNullConditionalOperators and PSUnixFileStat are mainstream in PowerShell 7.1. PSNullConditionalOperators introduces new operators for Null conditional member access operators – ?. and ?[]. And PSUnixFileStat adds data from the Unix stat API in the output of the file system provider to provide a more Unix-like file listing.

For a full list of changes in PowerShell 7.1, see Microsoft’s website here.

 

Related Topics:

  • PowerShell
  • BECOME A PETRI MEMBER:

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

    Register
    IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.