title: Filter Where-Object on variable property
body: <p>Read the following answers:
  (<a href="https://stackoverflow.com/questions/26296358/where-object-based-on-a-variable-content">Where object based on a variable content</a>), (<a href="https://stackoverflow.com/questions/43408185/use-array-of-strings-for-comparing-in-where-object-in-powershell">Use array of strings for comparing in Where-Object in PowerShell</a>)</p>
  
  <pre><code>$allgroups
  DisplayName
  --------
  Group1
  Group2
  Group3
  
  $mailgroups
  DisplayName
  --------
  Group1
  Group3
  
  $newgroup = $allgroups | ? ($_.DisplayName -notin $mailgroups)
  $newgroup = $allgroups | ? ($_.DisplayName -notin ($mailgroups | Select DisplayName))
  </code></pre>
  
  <p>$newgroup should = "DisplayName: Group2", above commands return null. Tried other operators:</p>
  
  <pre><code>-ne, -cnotin, -eq, -notcontains
  </code></pre>