title: Store output of ForEach into array in powershell
body: <pre><code>$data = @("server1","server2","server3")
  
  foreach ($server in $data) {
      $results = (Test-Connection $server -count 1 | Measure-Object -Property ResponseTime -Average).Average
  }
  </code></pre>
  
  <p>I'm trying to figure out how to take the output of a ForEach and store the results into an array so I may then compare them later. I could not come up with a way to do this yet.</p>