Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
PowerShell 7.5.4 includes the following features, updates, and breaking changes. PowerShell 7.5.4 is built on .NET 9.0.306 release.
For a complete list of changes, see the CHANGELOG in the GitHub repository. For more information about .NET 9, see What's new in .NET 9.
Breaking Changes
- Fix
-OlderThanand-NewerThanparameters forTest-Pathwhen usingPathTypeand date range (#20942) (Thanks @ArmaanMcleod!)- Previously
-OlderThanwould be ignored if specified together
- Previously
- Change
New-FileCatalog -CatalogVersiondefault to 2 (#20428) (Thanks @ThomasNieto!) - Block getting help from network locations in restricted remoting sessions (#20593)
- The Windows installer now remembers installation options used and uses them to initialize options for the next installation (#20420) (Thanks @reduckted!)
ConvertTo-Jsonnow serializesBigIntegeras a number (#21000) (Thanks @jborean93!)
Updated modules
PowerShell 7.5.4 includes the following updated modules:
- Microsoft.PowerShell.PSResourceGet v1.1.1
- PSReadLine v2.3.6
Tab completion improvements
Many thanks to @ArmaanMcleod and others for all their work to improve tab completion.
- Fall back to type inference when hashtable key-value cannot be retrieved from safe expression (#21184) (Thanks @MartinGC94!)
- Fix the regression when doing type inference for
$_(#21223) (Thanks @MartinGC94!) - Expand
~to$HOMEon Windows with tab completion (#21529) - Don't complete when declaring parameter name and class member (#21182) (Thanks @MartinGC94!)
- Prevent fallback to file completion when tab completing type names (#20084) (Thanks @MartinGC94)
- Add argument completer to
-VersionforSet-StrictMode(#20554) (Thanks @ArmaanMcleod!) - Add
-Verbargument completer forGet-Verb/Get-Commandand refactorGet-Verb(#20286) (Thanks @ArmaanMcleod) - Add
-Verbargument completer forStart-Process(#20415) (Thanks @ArmaanMcleod) - Add
-Scopeargument completer for*-Variable,*-Alias&*-PSDrivecommands (#20451) (Thanks @ArmaanMcleod) - Add
-Modulecompletion forSave-Help/Update-Helpcommands (#20678) (Thanks @ArmaanMcleod)
New cmdlets
- Add
ConvertTo-CliXmlandConvertFrom-CliXmlcmdlets (#21063) (Thanks @ArmaanMcleod!)
Web cmdlets improvements
- Fix to allow
-PassThruand-Outfilework together (#24086) - Add
OutFileproperty inWebResponseObject(#24047) - Show filename in
Invoke-WebRequest -OutFile -Verbose(#24041) - Fix WebCmdlets when
-Bodyis specified butContentTypeis not (#23952) (Thanks @CarloToso!) - Fix
Invoke-WebRequestto report correct size when-Resumeis specified (#20207) (Thanks @LNKLEO!) - Fix Web Cmdlets to allow
WinFormapps to work correctly (#20606)
Other cmdlet improvements
- Fix
Out-GridViewby replacing the use of obsoleteBinaryFormatterwith custom implementation (#25559) - Enable
-NoRestartto work withRegister-PSSessionConfiguration(#23891) - Add
IgnoreCommentsandAllowTrailingCommasoptions toTest-Jsoncmdlet (#23817) (Thanks @ArmaanMcleod!) - Get-Help may report parameters with
ValueFromRemainingArgumentsattribute as pipeline-able (#23871) - Change type of
LineNumbertoulonginSelect-String(#24075) (Thanks @Snowman-25!) Get-Process: Remove admin requirement for-IncludeUserName(#21302) (Thanks @jborean93!)- Fix
Test-Path -IsValidto check for invalid path and filename characters (#21358) - Add
RecommendedActiontoConciseViewof the error reporting (#20826) (Thanks @JustinGrote!) - Added progress bar for
Remove-Itemcmdlet (#20778) (Thanks @ArmaanMcleod!) - Fix
Test-Connectiondue to .NET 8 changes (#20369) - Fix
Get-Servicenon-terminating error message to include category (#20276) - Add
-Emptyand-InputObjectparameters toNew-Guid(#20014) (Thanks @CarloToso!) - Add the alias
rto the parameter-Recursefor theGet-ChildItemcommand (#20100) (Thanks @kilasuit!) - Add
LPtoLiteralPathaliases for functions still missing it (#20820) - Add implicit localization fallback to
Import-LocalizedData(#19896) (Thanks @chrisdent-de!) - Add
Aliasesto the properties shown up when formatting the help content of the parameter returned byGet-Help(#20994) - Add
HelpUritoRemove-Service(#20476) - Fix completion crash for the SCCM provider (#20815, #20919, #20915) (Thanks @MartinGC94!)
- Fix regression in
Get-Contentwhen-Tail 0and-Waitare used together (#20734) (Thanks @CarloToso!) - Fix
Start-Process -PassThruto make sure theExitCodeproperty is accessible for the returnedProcessobject (#20749) (Thanks @CodeCyclone!) - Fix
Group-Objectto use current culture for its output (#20608) - Fix
Group-Objectoutput using interpolated strings (#20745) (Thanks @mawosoft!) - Fix rendering of
DisplayRootfor networkPSDrive(#20793) - Fix
Copy-Itemprogress to only show completed when all files are copied (#20517) - Fix UNC path completion regression (#20419) (Thanks @MartinGC94!)
- Report error if invalid
-ExecutionPolicyis passed topwsh(#20460) - Add WinGetCommandNotFound and CompletionPredictor modules to track usage (#21040)
- Add DateKind parameter to
ConvertFrom-Json(#20925) (Thanks @jborean93!) - Add DirectoryInfo to the OutputType for New-Item (#21126) (Thanks @MartinGC94!)
- Fix
Get-Errorserialization of array values (#21085) (Thanks @jborean93!) - Fix
Test-ModuleManifestso it can use a UNC path (#24115) - Fix
Get-TypeDatato write to the pipeline immediately instead of collecting data first (#24236) (Thanks @MartinGC94) - Add
-Forceparameter toResolve-PathandConvert-Pathcmdlets to support wildcard hidden files #20981 (Thanks @ArmaanMcleod!) - Set standard handles explicitly when starting a process with
-NoNewWindow(#25324) - Make inherited protected internal instance members accessible in class scope. (#25547) (Thanks @mawosoft!)
- Remove the old fuzzy suggestion and fix the local script file name suggestion (#25330)
- Fix
PSMethodInvocationConstraints.GetHashCodemethod (#25306) (Thanks @crazyjncsu!)
Engine improvements
- Move .NET method invocation logging to after the needed type conversion is done for method arguments (#25357)
- Fallback to AppLocker after
WldpCanExecuteFile(#25305) - Explicitly start and stop ANSI Error Color (#24065) (Thanks @JustinGrote!)
- Improve .NET overload definition of generic methods (#21326) (Thanks @jborean93!)
- Optimize the
+=operation for a collection when it's an object array (#23901) (Thanks @jborean93!) - Add telemetry to check for specific tags when importing a module (#20371)
- Add
PSAdapterandConsoleGuiToolsto module load telemetry allowlist (#20641) - Add WinGet module to track usage (#21040)
- Ensure the filename is not null when logging WDAC ETW events (#20910) (Thanks @jborean93!)
- Fix four regressions introduced by the WDAC logging feature (#20913)
- Leave the input, output, and error handles unset when they are not redirected (#20853)
- Fix implicit remoting proxy cmdlets to act on common parameters (#20367)
- Include the module version in error messages when module is not found (#20144) (Thanks @ArmaanMcleod!)
- Fix
unixmodeto handlesetuidandstickywhen file is not an executable (#20366) - Fix using assembly to use Path.Combine when constructing assembly paths (#21169)
- Validate the value for using namespace during semantic checks to prevent declaring invalid namespaces (#21162)
- Handle global tool specially when prepending
$PSHOMEto PATH (#24228)
Experimental features
The following experimental features were converted to mainstream features in PowerShell 7.5-rc.1:
The following experimental features are included in PowerShell 7.5-rc.1:
- PSRedirectToVariable - Allow redirecting to a variable (#20381)
- PSNativeWindowsTildeExpansion - Add tilde expansion for Windows-native executables (#20402) (Thanks @domsleee!)
- PSSerializeJSONLongEnumAsNumber -
ConvertTo-Jsonnow treats large enums as numbers (#20999) (Thanks @jborean93!)
Performance improvements
PowerShell 7.5-rc.1 included PR#23901 from @jborean93 that improves the performance of the
+= operation for an array of objects.
The following example measures the performance for different methods of adding elements to an array.
$tests = @{
'Direct Assignment' = {
param($count)
$result = foreach($i in 1..$count) {
$i
}
}
'List<T>.Add(T)' = {
param($count)
$result = [Collections.Generic.List[int]]::new()
foreach($i in 1..$count) {
$result.Add($i)
}
}
'Array+= Operator' = {
param($count)
$result = @()
foreach($i in 1..$count) {
$result += $i
}
}
}
5kb, 10kb | ForEach-Object {
$groupResult = foreach($test in $tests.GetEnumerator()) {
$ms = (Measure-Command { & $test.Value -Count $_ }).TotalMilliseconds
[pscustomobject]@{
CollectionSize = $_
Test = $test.Key
TotalMilliseconds = [Math]::Round($ms, 2)
}
[GC]::Collect()
[GC]::WaitForPendingFinalizers()
}
$groupResult = $groupResult | Sort-Object TotalMilliseconds
$groupResult | Select-Object *, @{
Name = 'RelativeSpeed'
Expression = {
$relativeSpeed = $_.TotalMilliseconds / $groupResult[0].TotalMilliseconds
$speed = [Math]::Round($relativeSpeed, 2).ToString() + 'x'
if ($speed -eq '1x') { $speed } else { $speed + ' slower' }
}
} | Format-Table -AutoSize
}
When you run the script in PowerShell 7.4.6, you see that using the += operator is the slowest
method.
CollectionSize Test TotalMilliseconds RelativeSpeed
-------------- ---- ----------------- -------------
5120 Direct Assignment 4.17 1x
5120 List<T>.Add(T) 90.79 21.77x slower
5120 Array+= Operator 342.58 82.15x slower
CollectionSize Test TotalMilliseconds RelativeSpeed
-------------- ---- ----------------- -------------
10240 Direct Assignment 0.64 1x
10240 List<T>.Add(T) 184.10 287.66x slower
10240 Array+= Operator 1668.13 2606.45x slower
When you run the script in PowerShell 7.5-rc.1, you see that using the += operator is much faster
than PowerShell 7.4.6. Now, it's also faster than using the List<T>.Add(T) method.
CollectionSize Test TotalMilliseconds RelativeSpeed
-------------- ---- ----------------- -------------
5120 Direct Assignment 4.71 1x
5120 Array+= Operator 40.42 8.58x slower
5120 List<T>.Add(T) 92.17 19.57x slower
CollectionSize Test TotalMilliseconds RelativeSpeed
-------------- ---- ----------------- -------------
10240 Direct Assignment 1.76 1x
10240 Array+= Operator 104.73 59.51x slower
10240 List<T>.Add(T) 173.00 98.3x slower