By default, Measure-Object only returns a value for Count, omitting Average, Sum, Minimum, and Maximum unless those are each specified by analogous parameters.
Given that the perf impact of finding one of those additional values is the same as finding all of them ( O(n) ), we should add a -All parameter that
Steps to reproduce
1,2,3 | Measure-Object -All
Expected behavior
Count : 3
Average : 2
Sum : 6
Maximum : 3
Minimum : 1
Property :
Actual behavior
An error is thrown. But without -All, you just get:
Count : 3
Average :
Sum :
Maximum :
Minimum :
Property :
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1
OS Microsoft Windows 10.0.17613
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
By default, Measure-Object only returns a value for
Count, omittingAverage,Sum,Minimum, andMaximumunless those are each specified by analogous parameters.Given that the perf impact of finding one of those additional values is the same as finding all of them ( O(n) ), we should add a
-Allparameter thatSteps to reproduce
Expected behavior
Actual behavior
An error is thrown. But without
-All, you just get:Environment data