title: Need filtering help in PowerShell script
body: <p>I have an array with some server data and have following script:</p>
  <pre><code>Write-Host &quot;`nRemoving servers' accounts from AD:&quot; -ForegroundColor Green
  
  for ($j=0; $j-le $screenObj.Length; $j++)
  {if (($screenObj[$j].Domain -ne &quot;Unknown&quot;) -and ($screenObj.Where({$_ -ne &quot;&quot;})))
   {Try {Remove-ADComputer $screenObj[$j].ServerName -Server $screenObj[$j].Domain -Confirm:$false -WhatIf
    Write-Host $screenObj[$j].ServerName &quot;deleted.&quot; -ForegroundColor DarkYellow}
    Catch {Write-Host $screenObj[$j].ServerName &quot;:&quot; $_.Exception.InnerException.Message -ForegroundColor Red}
   }
   }
  </code></pre>
  <br>
  <p>It gives me following output:</p>
  <pre><code>Removing servers' accounts from AD:
  What if: Performing the operation &quot;Remove&quot; on target &quot;CN=Server1,OU=Application - With WINS,OU=Application,OU=W2K3,OU=Servers,OU=MY,DC=corp,DC=mycorp,DC=net&quot;.
  Server1 deleted.
  What if: Performing the operation &quot;Remove&quot; on target &quot;CN=Server2,OU=Application - With WINS,OU=Application,OU=W2K3,OU=Servers,OU=MY,DC=corp,DC=mycorp,DC=net&quot;.
  Server2 deleted.
  What if: Performing the operation &quot;Remove&quot; on target &quot;CN=Server3,OU=IIS,OU=W2K8,OU=Servers,OU=Europe,DC=TKMAXX,DC=mycorp,DC=net&quot;.
  Server3 deleted.
  What if: Performing the operation &quot;Remove&quot; on target &quot;CN=Server4,OU=IIS,OU=W2K8,OU=Servers,OU=Europe,DC=TKMAXX,DC=mycorp,DC=net&quot;.
  Server4 deleted.
   : The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
  
  </code></pre>
  <br>
  <p>I couldn't identify why is the last line in the output is coming as<br>
  <code>: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.</code>
  <br><br>
  Can someone explain this and help me to resolve this unknown warning?<br>
  Also, please let me know if there are better ways to achieve the desired output.<br>
  <b>Note:</b> I'm using <code>-WhatIf</code> option so that the servers aren't actually deleted.</p>