title: Turning Test-Connection error into a message
body: <p>I'm using the following code to get the status and IP addresses of machines in a list:</p>
  
  <pre><code>    $csv = Get-Content TEST_MACHINES.csv
  
      foreach ($computer in $csv)
      {
  try
  {
      Test-Connection $computer -Count 1 | Select-Object Address, IPV4Address
  }
  catch [System.Net.NetworkInformation.PingException]
  {
      '$computer is offline.'
  }
      }
  </code></pre>
  
  <p>The objective is to get the IP address of each machine, and if the machine is offline print "$computer is offline."</p>
  
  <p>However instead of catching the error and displaying the message, it displays the whole Test-Connection error.  How do I get it to only display my message when there's an error?</p>