Powershell adding values together
To compute average you can use Measure-Object
Cmdlet:
($array | Measure-Object -Average).average
One way I found to do the addition would be something like this:
$sum = $array -join '+'Invoke-Expression $sum
Your output of $sum
is simply going to add the "+" and then invoke-expression
will actually do the math for you. So your output would look something like:
$sum1+2+3+4+5+6+7+8+9Invoke-Expression $sum45