trying to run a powershell script with ExecuteShellcomandToVariable

powershell -nologo -executionpolicy bypass -noprofile (Test-Connection testserver -Count 10 |  Measure-Object responsetime  -Average).Average

I get an error saying it cant handle Measure-Object

so Im thinking the ExecuteShellcomandToVariable cant deal with a pipe in the comande line

would that be the case?

how would be the correct way to write this script in the ExecuteShellcomandToVariable ?