PowerShell 7 Preview 6
Today we shipped PowerShell 7 Preview.6! This release contains a number of new features and many bug fixes from both the community as well as the PowerShell team. See the Release Notes for all the details of what is included in this release.
This will be the last preview release as we head towards a Release Candidate in December. For the Release Candidate, there will be no more new features although small changes to cmdlets may still be accepted depending on risk of the change. Bug fixes will still be accepted but also accessed for their risk of causing a regression. Finally, we expect General Availability of PowerShell 7 in January as our first Long Term Servicing release.
New Features in Preview 6
This release has a number of new features from both the community as well as the PowerShell team. Remember that preview releases of PowerShell are installed side-by-side with stable versions so you can use both and provide us feedback on previews for bugs and also on experimental features.
You can read about new features in previous preview releases:
There were new features in Preview 1 and Preview 2, but I didn’t blog about them… sorry!
Skip Error Check for Web Cmdlets
Great addition by community member Vincent Damewood to allow skipping the internal HTTP response error check within the web cmdlets. This means that you can now handle the web error yourself including getting the response object as well as the HTTP response headers whereas previously you would have to get it from the resulting error object.
Null Conditional Member Property and Method Access
This is a new language feature that allows you to skip checking if a variable is
$null before indexing into the variable, calling a method, or accessing a property. For properties, PowerShell will already allow accesing properties of
$null, but this new syntax makes it more clear the intent in the script. Note that because PowerShell allows variable names to end with a question mark, you must use braces around the variable name
Extended Unix Filesystem Information
For users of PowerShell on Linux and macOS, they may miss some of the additional information of the filesystem provided by
ls -l (long form of a directory listing). This new feature makes that information available using
Get-ChildItem so you are no longer missing any useful information.
Windows PowerShell Compatibility in Preview 6
This release also improves the compatibility of PowerShell 7 with Windows PowerShell 5.1. We’ve brought back many existing cmdlets from Windows PowerShell 5.1 thanks to .NET Core 3! In addition, we have a new feature included with PowerShell 7 that encapsulates the Windows Compatibility Module (more on that below!).
Set-Clipboard are back! Not only are they available again, but they are cross platform compatible which means you can use them on Linux (requires xclip to be installed) and macOS. Note that only text is supported at this time even on Windows.
Performance Counter Cmdlets
Get-Counter is back allowing you to get Windows performance counter information. Note that
Export-Counter cmdlets are not supported in PowerShell 7.
Graphical Tools Cmdlets
With .NET Core 3.0 bringing back WPF support on Windows, we’ve been able to bring back some popular graphical tools.
Out-GridView gives a dynamic table view of results in a pipeline with sorting and filtering capabilities and when used with
-PassThru can be used interactively within a pipeline to select objects to send back to the pipeline.
Show-Command gives a graphical view of a command including parameter sets, parameters, switches, etc… Finally,
-ShowWindow works again to give a graphical view of PowerShell help content.
Update-List, Out-Printer, and Clear-RecycleBin cmdlets
Update-List allows adding/removing items from a property value that contains a collection of objects within a pipeline. This cmdlet is cross-platform compatible.
Out-Printer sends a PowerShell object to the printer. This cmdlet is only supported on Windows currently.
Clear-RecycleBin empties the recycle bin and is currently only supported on Windows.
The original implementation of
Test-Connection in Windows PowerShell relied on WMI which made it not cross-platform compatible.
Community member and PowerShell repo maintainer Ilya Sazonov ported the cmdlet to work against .NET Core APIs in PowerShell Core 6 making it work cross-platform. However, this also changed the user experience.
For PowerShell 7, Joel Sallow, another community member made improvements to this cmdlet and also getting back to similar experience as the original cmdlet in Windows PowerShell.
Import Windows PowerShell Modules in PS7
For PowerShell Core 6, we introduced the Windows Compatibility Module to allow importing Windows PowerShell modules that were not compatible with PowerShell Core 6 leveraging WinRM and implicit remoting.
In PowerShell 7, we have included this functionality into
Import-Module directly without relying on WinRM, but does rely on Windows PowerShell 5.1 (it won’t work if Windows PowerShell 5.1 is not available).
Basically, for modules in the System32 folder, if the module manifest doesn’t indicate that module is compatible with
Core then that module will be loaded in a Windows PowerShell process and using implicit remoting reflected into your PowerShell 7 session.
More details of this feature along with other information regarding Windows PowerShell compatibility in general coming in a separate blog post.
These are the last of the big changes coming in PowerShell 7 as we heads toward a Release Candidate next month. Please try out this preview and report issues in our GitHub repo as we still have opportunity to fix existing bugs as well as new bugs introduced by these features.
Steve Lee PowerShell Team