General Availability of PowerShell 7.2
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.
What’s new?
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.
Other improvements
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
What’s next?
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!
Is there anything specific we need to do to use the native arm64 version of PowerShell on a M1 Mac if we are upgrading from a previous version, or will the change happen automatically?
Windows 11 ships with PowerShell and PowerShell ISE. This is incredibly confusing.
Will installing PowerShell 7.2 replace the inbox versions that ship with Windows, or do we have to remove that version using the Control Panel so that we don’t end up with two separate versions – which is confusing and can result in launching the wrong version when we use search to launch applications (given Windows 11’s less productive Start Menu design)?
Powershell 5.1 and Powershell ISE are kept and supported in the same way Notepad and Cmd are, to ensure backwards compatibility.
Powershell 7.2 is a completely separate executable run side-by-side with these, pwsh.exe vs powershell.exe, you can have them both installed with no problems. You can also install via the Microsoft Store!
Powershell 7.2 also auto-updates via Microsoft Update, and while there are support challenges in having 7.2 "in-box" with Windows, the team is pursuing several paths...
Ah, PowerShell 7.2 is finally here! I’ve been eagerly expecting it. 🎉
Here is a question for you, Mr. Lee: Let’s imagine I’m working in a PowerShell window, but I’ve forgotten which version of .NET it is using. Is there a command that can tell me?
You used to be able to get it from `$PSVersionTable` but the CLR isn’t there anymore. So you can drop back to the .NET approach which is simply `[System.Environment]::Version`. This gives you a version structure with the version of the framework that PS is currently running.
Much obliged! 🙏😊🙏
Why do you care the version? Regardless you can look at $PSVersionTable and correlate the version this way since it follows the .NET lifecycle:
7.2 – net6.0
7.1 – net5.0
7.0 – netcoreapp3.1
5.1 – netframework461
Hi. Kindly read the question fully before trying to answer it. Thanks in advance. 🙏 And respectfully, your answer sounds confrontational. I think it is best we didn’t converse in the future altogether.
Any word on fixing https://github.com/PowerShell/PowerShell/issues/15476 and, more concretely, https://github.com/PowerShell/PowerShell/issues/14757? I’ll be sticking with the 7.0 series until the insanity is fixed.
You’ve got a senior member of the team posting announcement screenshots off a Mac and comments on that issue saying that Linux is their most important platform. Consistency, and in particular the vision of PowerShell not being bound by old Unix limitations and problems, seems to be a lost concept now.
The appropriate Working Groups are tagged for each issue. We rely on them along with community feedback to make a decision. It seems that for both of them, there are some reasons why they behave the way they behave and some disagreement on what is the desired behavior.