PowerShell v7.6.0-preview4

The latest preview 4 version of PowerShell v7.6 was recently made available, and in this short blog post, I will show you the highlights and how to install or update it if you have already installed a previous version.

What’s new?

Updated Modules

There was one updated module included in the release:

  • Microsoft.PowerShell.ThreadJob v2.2.0

ThreadJob v2.1.0 The ThreadJob module was renamed to Microsoft.PowerShell.ThreadJob. There is no difference in the functionality of the module. To ensure backward compatibility for scripts that use the old name, the ThreadJob v2.1.0 module is a proxy module that points to the Microsoft.PowerShell.ThreadJob v2.2.0.

Breaking changes

  • Fix WildcardPattern.Escape to escape lone backticks correctly (#25211) (Thanks @ArmaanMcleod!)
  • Convert -ChildPath parameter to string[] for Join-Path cmdlet (#24677) (Thanks @ArmaanMcleod!)

Engine updates and Fixes

  • Add PipelineStopToken to Cmdlet which will be signaled when the pipeline is stopping (#24620) (Thanks @jborean93!)
  • Fallback to AppLocker after WldpCanExecuteFile (#24912)
  • Move .NET method invocation logging to after the needed type conversion is done for method arguments (#25022)
  • Fix share completion with provider and spaces (#19440) (Thanks @MartinGC94!)

General Cmdlet Updates and Fixes

  • Exclude -OutVariable assignments within the same CommandAst when inferring variables (#25224) (Thanks @MartinGC94!)
  • Fix infinite loop in variable type inference (#25206) (Thanks @MartinGC94!)
  • Update Microsoft.PowerShell.PSResourceGet version in PSGalleryModules.csproj (#25135)
  • Add tooltips for hashtable key completions (#17864) (Thanks @MartinGC94!)
  • Fix type inference of parameters in classic functions (#25172) (Thanks @MartinGC94!)
  • Improve assignment type inference (#21143) (Thanks @MartinGC94!)
  • Fix TypeName.GetReflectionType() to work when the TypeName instance represents a generic type definition within a GenericTypeName (#24985)
  • Remove the old fuzzy suggestion and fix the local script filename suggestion (#25177)
  • Improve variable type inference (#19830) (Thanks @MartinGC94!)
  • Fix parameter completion when script requirements fail (#17687) (Thanks @MartinGC94!)
  • Improve the completion for attribute arguments (#25129) (Thanks @MartinGC94!)
  • Fix completion that relies on pseudobinding in script blocks (#25122) (Thanks @MartinGC94!)
  • Don’t complete duplicate command names (#21113) (Thanks @MartinGC94!)
  • Make SystemPolicy public APIs visible but non-op on Unix platforms so that they can be included in PowerShellStandard.Library (#25051)
  • Set standard handles explicitly when starting a process with -NoNewWindow (#25061)
  • Fix tooltip for variable expansion and include desc (#25112) (Thanks @jborean93!)
  • Add type inference for functions without OutputType attribute and anonymous functions (#21127) (Thanks @MartinGC94!)
  • Add completion for variables assigned by command redirection (#25104) (Thanks @MartinGC94!)
  • Handle type inference for redirected commands (#21131) (Thanks @MartinGC94!)
  • Allow empty prefix string in Import-Module -Prefix to override default prefix in manifest (#20409) (Thanks @MartinGC94!)
  • Update variable/property assignment completion so it can fallback to type inference (#21134) (Thanks @MartinGC94!)
  • Use Get-Help approach to find about_*.help.txt files with correct locale for completions (#24194) (Thanks @MartinGC94!)
  • Use script filepath when completing relative paths for using statements (#20017) (Thanks @MartinGC94!)
  • Fix completion of variables assigned inside Do loops (#25076) (Thanks @MartinGC94!)
  • Fix completion of provider paths when a path returns itself instead of its children (#24755) (Thanks @MartinGC94!)
  • Enable completion of scoped variables without specifying scope (#20340) (Thanks @MartinGC94!)
  • Fix issue with incomplete results when completing paths with wildcards in non-filesystem providers (#24757) (Thanks @MartinGC94!)
  • Allow DSC parsing through OS architecture translation layers (#24852) (Thanks @bdeb1337!)

Code Cleanup

  • Refactor and add comments to CompletionRequiresQuotes to clarify implementation (#25223) (Thanks @ArmaanMcleod!)
  • Add QuoteCompletionText method to CompletionHelpers class (#25180) (Thanks @ArmaanMcleod!)
  • Remove CompletionHelpers escape parameter from CompletionRequiresQuotes (#25178) (Thanks @ArmaanMcleod!)
  • Refactor CompletionHelpers HandleDoubleAndSingleQuote to have less nesting logic (#25179) (Thanks @ArmaanMcleod!)
  • Make the use of Oxford commas consistent (#25139)(#25140)(Thanks @pressRtowin!)
  • Move common completion methods to CompletionHelpers class (#25138) (Thanks @ArmaanMcleod!)
  • Return Array.Empty instead of collection [] (#25137) (Thanks @ArmaanMcleod!)

Tools

  • Check GH token availability for Get-Changelog (#25133)

Tests

  • Add XUnit test for HandleDoubleAndSingleQuote in CompletionHelpers class (#25181) (Thanks @ArmaanMcleod!)

Build and Packaging Improvements

  • Switch to ubuntu-lastest for CI (#25247)
  • Update outdated package references (#25026)(#25232)
  • Bump Microsoft.PowerShell.ThreadJob and ThreadJob modules (#25232)
  • Bump github/codeql-action from 3.27.9 to 3.28.13 (#25218)(#25231)
  • Update .NET SDK to 10.0.100-preview.2 (#25154)(#25225)
  • Remove obsolete template from Windows Packaging CI (#25226)
  • Bump actions/upload-artifact from 4.5.0 to 4.6.2 (#25220)
  • Bump agrc/reminder-action from 1.0.15 to 1.0.16 (#25222)
  • Bump actions/checkout from 2 to 4 (#25221)
  • Add NoWarn NU1605 to System.ServiceModel.* (#25219)
  • Bump actions/github-script from 6 to 7 (#25217)
  • Bump ossf/scorecard-action from 2.4.0 to 2.4.1 (#25216)
  • Bump super-linter/super-linter from 7.2.1 to 7.3.0 (#25215)
  • Bump agrc/create-reminder-action from 1.1.16 to 1.1.17 (#25214)
  • Remove dependabot updates that don’t work (#25213)
  • Update GitHub Actions to work in private GitHub repo (#25197)
  • Cleanup old release pipelines (#25201)
  • Update package pipeline windows image version (#25191)
  • Skip additional packages when generating component manifest (#25102)
  • Only build Linux for packaging changes (#25103)
  • Remove Az module installs and AzureRM uninstalls in pipeline (#25118)
  • Add GitHub Actions workflow to verify PR labels (#25145)
  • Add back-port workflow using dotnet/arcade (#25106)
  • Make Component Manifest Updater use neutral target in addition to RID target (#25094)
  • Make sure the vPack pipeline does not produce an empty package (#24988)

How to

Install

I like to install things using WinGet, so I used this command-line to install it (which will install it in a separate folder next to the regular PowerShell v7), which looks like this:

winget install --id Microsoft.PowerShell.Preview --source winget
Found PowerShell Preview [Microsoft.PowerShell.Preview] Version 7.6.0.4
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed

(In the above example, WinGet downloads and installs, this MSI file https://github.com/PowerShell/PowerShell/releases/download/v7.6.0-preview.4/PowerShell-7.6.0-preview.4-win-x64.msi)

Upgrade

For best results when upgrading, you should use the same install method you used when you first installed PowerShell. If you aren’t sure how PowerShell was installed, you can check the value of the $PSHOME variable, which always points to the directory containing PowerShell that the current session is running.

  • If the value is $HOME\.dotnet\tools, PowerShell was installed with the .NET Global tool.
  • If the value is $Env:ProgramFiles\PowerShell\7, PowerShell was installed as an MSI package or with WinGet on a computer with an X86 or x64 processor.
  • If the value starts with $Env:ProgramFiles\WindowsApps\, PowerShell was installed as a Microsoft Store package or with WinGet on computer with an ARM processor.
  • If the value is anything else, it’s likely that PowerShell was installed as a ZIP package.

Wrapping up

That’s all about the latest preview version. Check it out and test some of your scripts in it. Have a lovely weekend!

2 thoughts on “PowerShell v7.6.0-preview4

Leave a Reply to TachaeonCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.