PowerShell 7.2 now Generally Available

Reading time icon 4 min. read


Readers help support MSPoweruser. When you make a purchase using links on our site, we may earn an affiliate commission. Tooltip Icon

Read the affiliate disclosure page to find out how can you help MSPoweruser effortlessly and without spending any money. Read more

Today Microsoft announced the General Availability of PowerShell 7.2.

The release is built on .NET 6 and includes many performance improvements, bug fixes, and new APIs to use in your scripts.

This version, being an even-numbered minor version, is being released into Long Term Support (LTS) for 3 years. Odd-numbered versions only receive 1 year of support.

Microsoft will now move on to developing PowerShell 7.3, for release in Q1 2022.

Here are the highlights of PowerShell 7.2.

Microsoft Update support

PowerShell 7.2 has integration with Microsoft Update to automatically keep your installation of 7.2 updated whenever Microsoft 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, Microsoft continues 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 Microsoft’s stable channel where you would be updated to 7.2.1 should Microsoft 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 colour for metadata vs data when using a table or list view:

Color table and list

In 7.2, Microsoft 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:

Decorated text example

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 colour:

Subtle color example

Any customizations would need to be stored in your $Profile to be retained.

You can find more about $PSStyle and ANSI in Microsoft’s 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, Microsoft 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.  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 Microsoft’s 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 were a number of them came from the community! You can read the details in Microsoft’s changelogs or the summary in Microsoft’s What’s new documentation

You can read the full changelog here.

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.

More about the topics: powershell, powershell 7.2