title: Powershell: Foreach not working?
body: <p>So I have an issue with my foreach loop, and I cant figure out what I am doing wrong.</p>
  
  <p>The following is an example of my code:  </p>
  
  <pre><code> $objectarray ##( So this variable contains a list of lists ie name + address) ##
  
   Foreach ($object in $objectarray.name){
  
  
  $objectid = $objectarray.Where({$_.name -eq "$object"}).id
  $objectaddress = $objectarray.Where({$_.name -eq "$object"}).address
  
  $objectprint = "$objectid" + ": " + "$objectaddress"
  
  $objectprint
  return 0
  
  }
  </code></pre>
  
  <p>Now the problem is <strong>$objectarray</strong> has multiple lists inside it each with its name, id, address etc</p>
  
  <p>But it ONLY prints the FIRST one, and I get ONLY the first 0 as return...despite the fact there are many of them</p>