Find the Median Value
# sort array $NumberArray = $NumberArray | Sort-Object if ($NumberArray.count%2) { # if odd $medianvalue = $NumberArray[[math]::Floor($NumberArray.count/2)] } else { # if even $MedianValue = ($NumberArray[$NumberArray.Count/2],$NumberArray[$NumberArray.count/2-1] | Measure-Object -Average).average } $MedianValue
Single object array
[System.Collections.ArrayList] $ArrStrings = @() $ArrStrings.Add("string") | Out-Null
Standard PowerShell Object Array
[System.Collections.Generic.List[PSObject]] $arr = @() $arr.Add($objectA) $arr.Add($objectB)