November 21st, 2019

PowerShell 7 Preview 6

Steve Lee
Principal Software Engineer Manager

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!).

Clipboard Cmdlets

Get-Clipboard and 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 Import-Counter and 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, Get-Help -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.

Test-Connection Improvements

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.

Closing

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.

Thanks!

Steve Lee PowerShell Team

Category
PowerShell

Author

Steve Lee
Principal Software Engineer Manager

Principal Software Engineer Manager PowerShell 7, PowerShellGet, PSScriptAnalyzer, VSCode-PowerShell extension, PowerShellEditorServices, etc...

7 comments

Discussion is closed. Login to edit/delete existing comments.

  • Frank K.

    Hi,
    bringing back 'Out-GridView' is great, but it is a bit confusing to have the platform independent grid, too
    (https://github.com/PowerShell/GraphicalTools)
    Before both of these were announced, I did a prototype with a DevExpress XtraGrid because it is very powerful and I am very familiar with it's GUI.
    Another 'Windows-only' feature that seems to be missing in PowerShellCore is the PackageProvider named 'Programs' which can be used to list the installed programs like in 'Control...

    Read more
  • J S

    How about a 100 ms timeout for test-connection?

  • Miodrag Milić

    Amazing release.

    Since first recycle bin function is released, are there any plans for complete cross-platform module that will also take into account: delete and restore and even browsing via psdrive. Many folks actually replace rm with custom version that is usually poor replacement (i.e. not done via proxy functions so it breaks scripts).

  • Daniel Schroeder

    Awesome update. My favourites are the Null Conditional and the Graphical Tools being brought back 🙂 Also, thank you so much for listening to previous comments Steve and switching from gifs to videos for the previews; it makes reading these updates a much nicer experience 👍

  • Mihail Stacanov

    Thanks for your effort. What do you use in your videos with tabs to see all these different environments?

  • Mike-E

    Man, this has nothing to do with PowerShell 7 but PowerShell in general... I have to give everyone there a serious bow of respect and appreciation for all your work in this fantastic product, and paradigm, really.

    Every time I fire up this sucker I am able to get done what I need done with hardly any friction if at all. I recently had to set up a CD/CI environment with AppVeyor which of course...

    Read more