Microsoft seems to be actively developing and improving PowerShell Core. Not long ago, Microsoft released PowerShell 7.1 in November and now we are here with a new release of PowerShell 7.2 Preview 2.
The preview 2 is still based on .NET 5, as .NET 6 is yet to be released. However, Microsoft claims that the stable version of PowerShell 7.2 will be based on .NET 6.
Let’s see what PowerShell 7.2.0 brings to the table.
Download PowerShell 7.2.0 Preview 2
For Windows 10, Windows 8.1 and Windows 7
PowerShell-7.2.0-Preview2-win-x64.msi [95.1 MB]
PowerShell-7.2.0-Preview2-win-x86.msi [85.9 MB]
For MacOS
powershell-7.2.0-Preview2-osx-x64.pkg [63.4 MB]
For Linux
CentOS
powershell-7.2.0-Preview2-1.centos.8.x86_64.rpm [64.7 MB]
Debian
powershell_7.2.0-Preview2-1.debian.11_amd64.deb [65.2 MB]
powershell_7.2.0-Preview2-1.debian.10_amd64.deb [65.2 MB]
Ubuntu
powershell_7.2.0-Preview21.ubuntu.20.04_amd64.deb [65.2 MB]
powershell_7.2.0-Preview2-1.ubuntu.18.04_amd64.deb [65.2 MB]
powershell_7.2.0-Preview2-1.ubuntu.16.04_amd64.deb [65.2 MB]
For more download options, please checkout this download page.
PowerShell 7.2.0 Preview 2 features
Thanks to Microsoft and PowerShell contributors, some significant changes have been made to the released version. Some new features and bug fixes have been highlighted in the release post by Microsoft. Let’s shed some light on what those are.
New feature
PSStyle automatic variable for ANSI rendering
This is an experimental feature. Meaning, Microsoft is currently awaiting users’ feedback to see whether or not to release this feature with the stable release of PowerShell 7.2.
The ANSI escape code is an extension of the ASCII escape code. This feature will make it easier for the users to author content containing the ANSI code, which controls the text decoration parameters, such as its font, color, size, italics, etc.
You can read more about the feature here.
Bug fixes
Some issues that accompanied the previous release of PowerShell have also been addressed with this Preview release.
- Code Cleanup: Microsoft states that nearly two-thirds of the pull requests have been answered, resulting in a code cleanup. This refers to a piece of code dedicated to cleanup leftover data and other unneeded material from the system after the actual code has been executed.
- An issue of the users receiving a bugcheck of “Incorrect Function” when trying to use an executable file on a drive that is not in the NTFS format has been addressed. This issue was first experienced with PowerShell 7.1 due to an issue with the reparse points, which has now been fixed.
- PipelineVariable Common Parameter: This object now correctly contains all of the parameters passed through it, instead of containing just the first input parameter.
Here is the complete changelog:
Changed:
- Improve detection of mutable value types
- Ensure
-PipelineVariable
is set for all output from script cmdlets
New experimental Features:
PSAnsiRendering
: Enable ANSI formatting via$PSStyle
and support suppressing ANSI output
Improved performance:
- Optimize
IEnumerable
variant of replace operator - Refactor multiply operation for better performance in two
Microsoft.PowerShell.Commands.Utility
methods - Use
Environment.TickCount64
instead ofDatetime.Now
as the random seed for AppLocker test file content - Avoid unnecessary array allocations when searching in GAC
- Use
OrdinalIgnoreCase
inCommandLineParser
- Use
StringComparison.Ordinal
instead ofStringComparison.CurrentCulture
- Avoid creating instances of the generated delegate helper class in
-replace
implementation
General Cmdlet Updates and Fixes:
- Write better error message if config file is broken
- Make AppLocker Enforce mode take precedence over UMCI Audit mode
- Add
-SkipLimitCheck
switch toImport-PowerShellDataFile
- Restrict
New-Object
in NoLanguage mode under lock down - The
-Stream
parameter now works with directories - Avoid an exception if file system does not support reparse points
- Enable
CA1012
: Abstract types should not have public constructors - Enable
SA1212
: Property accessors should follow order
You can learn more about the PowerShell 7.2 changelog from here.
How to install PowerShell 7.2 Preview 2 in Windows 10
Use the guide provided to download PowerShell 7.2 on Windows 10, 8.1, and 7.
- Download the respective .MSI file from the links provided above.
- Execute the downloaded package. In the installation wizard, click Next.
- On the next screen, choose a destination path to save the new installation and then click Next.
- Now select the optional features you wish to install by checking the boxes next to them. You can add PowerShell to the environment variables, enable PowerShell remoting, add PowerShell to the context menu, etc. Click Next when done.
- Click Install to begin the process.
- The installation should be completed in less than a minute. Click on Finish when it is. You may also check the box next to Launch PowerShell to do so before hitting Finish.
- Now verify that the installation has been completed by typing in pwsh in Run. You will then see a version of PowerShell running.
You may also download the latest stable release of PowerShell by running the following command in the existing PowerShell on your Windows:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
You can also download and install PowerShell over the network. This method is best suited for sysadmins.
Closing words
PowerShell 7.2 is still in preview so you should never install it on a production system. But it is always fun to test out the new features on a dev machine. If you love automation on Windows 10 and Windows Server, you should definitely check out this new release of PowerShell.