title: PowerShell - Not creating Jagged Array within forEach loop
body: <p>So, I'm having an issue enumerating through a forEach loop in PowerShell (v3) and adding the variable being evaluated, as well as a Test-Connection result into an array. I'm trying to make $arrPing a multi-dimensional array as this will make it easier for me to filter and process the objects in there later in the script, but I'm encountering issues with the code.</p>
  
  <p>My code looks like the following:</p>
  
  <pre><code>$arrPing= @();
  $strKioskIpAddress= (Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null }).ipaddress
  
  ...FURTHER DOWN THE CODE...
  
  $tmpIpAddress= Select-Xml -Path $dirKioskIpAddresses -XPath '//kiosks/kiosk' | Select-Object -ExpandProperty Node
  
  forEach ( $entry in $tmpIpAddress )
      {
      if ( $entry -ne $strKioskIpAddress )
          {
          $result= Test-Connection -ComputerName $entry -Count 1 -BufferSize 16 -Quiet -ErrorAction SilentlyContinue
          $arrPing+= @($entry,$result);
          }
      }
  </code></pre>
  
  <p>But I'm getting the following output when I display the contents of the $arrPing variable:</p>
  
  <pre><code>PS H:\Documents\PowerShell Scripts&gt; $arrPing
  10.216.1.134
  True
  10.216.1.139
  True
  10.216.23.230
  True
  10.216.23.196
  False
  10.216.23.23
  False
  </code></pre>
  
  <p>Can anyone tell me where I'm going wrong? I have a feeling that this is happening because I'm in a forEach loop but I just can't say for sure...</p>