We’re pleased to announce the General Availability of PowerShell 7.2! This release continues our even numbered minor version releases as Long Term Support (LTS). The odd numbered minor versions will continue to have a 1 year support lifecycle. This means that this release will be supported in production for 3 years (end of support would be around end of 2024).
This release is built on .NET 6! This includes many performance improvements, bug fixes, and new APIs to use in your scripts.
Our last LTS release was PowerShell 7.0 which means that there is a 1 year overlap where PowerShell 7.0 is still supported and 7.2 is available. We would recommend using this time to evaluate 7.2 and report any issues that would prevent migration to 7.2 from 7.0.
How to get it?
Depending on your operating system, there are a number of ways to install PowerShell 7.
On Windows, starting with 7.2, if you install using the MSI package, then PowerShell 7 will be setup to automatically update via Microsoft Update.
Alternatively, if you install from the Microsoft Store, then PowerShell 7 will also be automatically updated, however, you would need to install the MSI on Windows Server to get the automatic update capability as the Microosft Store is not supported on Windows Server. The Microsoft Store release has both stable and preview release channels which work side-by-side should you have both installed.
On Linux and macOS, you would continue to update using the same method you used to install.
We have a more comprehensive doc on what’s new in 7.2, but here are some highlights:
Microsoft Update support
As noted above, we have integration with Microsoft Update to automatically keep your installation of 7.2 updated whenever we have a servicing release which only includes critical bug fixes or security updates.
The MSI installer will automatically enable updating PowerShell 7 as well as enabling Microsoft Update. You can choose to opt out of the automatic update during install if you prefer to manually update PowerShell 7 yourself.
For Microsoft Update, we continue to have both preview and stable channels (where you can use both side-by-side). So if you have a preview of 7.2 installed and enabled Microsoft Update, then you will be updated to 7.3 preview once that is available. You would need to install 7.2 GA separately to have Microsoft Update enabled for our stable channel where you would be updated to 7.2.1 should we have a servicing release and eventually to 7.3 GA.
Enhanced ANSI support
ANSI escape sequences are an industry standard way to provide text decoration support (among other capabilities in the terminal) between the console and a supported terminal.
Use of these decorations is a common way for command-line tools and shells to highlight or distinguish information. For example, a new feature in 7.2 is to use a different color for metadata vs data when using a table or list view:
In 7.2, we’ve added a new built-in variable called $PSStyle to make it easy to add decoration to your scripts or cmdlets as well as control use of ANSI escape sequences. You can use this to add coloring, italics, background colors, etc.. and because it’s a variable, you can use tab-completion to discover what you can do.
Here’s an example to decorate some text:
The $PSStyle variable also lets you customize the colors and decorations being used. For example, you may prefer something more subtle for table headers than the default green color:
Any customizations would need to be stored in your $Profile to be retained.
You can find more about $PSStyle and ANSI in our documentation about using an ANSI terminal.
Predictive Intellisense with PSReadLine
This is a feature in PSReadLine 2.1 which ships with PowerShell 7.2. To make the interactive console more productive, particularly with repetitive tasks, we’ve added a feature to use your history to predict what you may be typing. This feature must be enabled and you can also customize the colors used for the predictive text. Here, I’ve changed the default color to something more visible. You would use the right arrow key to accept the prediction or keep typing which can affect the prediction.
You can read more about it in our previous blog post specifically on this feature as well as leveraging the Az Predictor plugin for AzPowerShell specific predictions.
There are numerous bug fixes and small improvements where a number of them came from the community! You can read the details in our changelogs or the summary in our What’s new documentation
Development will continue with PowerShell 7.3. The changes that have been made that didn’t meet the bar for 7.2 will be in the first preview of 7.3. A more detailed plan for PowerShell team investments during the 7.3 timeframe (calendar year 2022) will be published in the first quarter of 2022.
Much thanks to our team members, community contributors, community working group members, and the .NET team for making this release possible!