When used without any parameters, Measure-Object will return a value for Count, which is the number of items passed in using the pipeline, for example:
PS> 1, 5, 9, 79 | Measure-Object
Count : 4
Average :
Sum :
Maximum :
Minimum :
Property :
Each of the remaining properties is empty, unless requested using their respective parameters. For example, Sum may be requested:
PS> 1, 5, 9, 79 | Measure-Object -Sum
Count : 4
Average :
Sum : 94
Maximum :
Minimum :
Property :
Adding the remaining parameters will fill in the rest of the fields (except Property):
PS> 1, 5, 9, 79 | Measure-Object -Average -Maximum -Minimum -Sum
Count : 4
Average : 23.5
Sum : 94
Maximum : 79
Minimum : 1
Property :
The value for Property is filled in when Measure-Object is asked to work against a particular property (instead of a set of numbers), for example:
PS> Get-Process | Measure-Object WorkingSet -Average
Count : 135
Average : 39449395.2
Sum :
Maximum :
Minimum :
Property : WorkingSet
When working with text, Measure-Object can count characters, words, or lines. For example, it can be used to count the number of lines, words, and characters in a text file:
PS> Get-Content C:WindowsWindowsUpdate.log | Measure-Object -Line -Word -Character
Lines Words Characters Property
----- ----- ---------- --------
3 32 267