Summary: Easily find the largest number in a Windows PowerShell array.
How can I use Windows PowerShell to easily find the largest number in an array of numbers?
Pipe the array to the Measure-Object cmdlet, and use the –Maximum switch:
PS C:\> $a = [array]1,2,5,6,3,2,9,1
PS C:\> $a | measure -Maximum
Count : 8
Average :
Sum :
Maximum : 9
Minimum :
Property :