title: Removing an item from a array of objects in Powershell
body: <p>I have an array object $a which returns an output like below.</p>
  
  <p><img src="https://i.stack.imgur.com/s3b7u.png" alt="Suppose $a returns this"></p>
  
  <p>And by doing $a[0].Name I can access each "Name" entry,  $a[0].Available I can access its corresponding Available space.</p>
  
  <p>I have another array say $b which contains some names, say $b returns me two names "sandeep_aggr1" and "aggr4". This is just an array (no properties like Name, Avaiable), not an object, so It can't use Compare-Object.</p>
  
  <p>I want to remove other entries in the original object $a, except for those with "Name" equal to "sandeep_aggr1" and "aggr4".</p>
  
  <p>This is what I am doing.</p>
  
  <pre><code>foreach($bb in $b)
      {
            foreach($aa in $a)
            {
                  if($aa.Name -ne $bb)
                  {
                     $aa.Remove($aa.Name)
                  }
  
            }
  
  
      }
  
      echo $a
  </code></pre>
  
  <p>But, I don't see the elements deleted, am I missing something here ?
   Any help appreciated</p>