title: Where-Object filter selection using string array
body: <p>I have a custom object with the Properties: Name, Value and others. </p>
  
  <p>I'm trying to filter using <code>Where</code> by the name property, using an array:</p>
  
  <pre><code>$NamesToExclude= @('Person1', 'Person2', 'Person3', 'Person4')
  
  $CustomObj | Where-Object {$_.Name -ne $NamesToExclude}
  </code></pre>
  
  <p>This returns all excluded names (and others). I have also tried:</p>
  
  <pre><code>{$_.Name -ne $($NamesToExclude)}
  </code></pre>
  
  <p>and tried using the <code>-notlike</code> operator. What am I doing wrong?</p>