title: Checking for the existence of an AD object; how do I avoid an ugly error message?
body: <p>I have a bit of code that looks like this:</p>
  
  <pre><code>if (Get-ADUser $DN -EA SilentlyContinue) {
    # Exists
  } else {
    # Doesn't Exist
  }
  </code></pre>
  
  <p>Unfortunately, when Get-ADUser the DN fails to find a user (which is fine, it means the object name is not taken), it throws up and spits out an error. I know it will fail, that's fine, which is why I have an <code>-ErrorAction</code> to <code>SilentlyContinue</code>. Unfortunately it seems to do nothing... I still get barf on the script output. The code works, it's just ugly due to the console spitting out the error.</p>
  
  <ul>
  <li>Is there a better way for me to test whether a particular object exists?</li>
  <li>If not, is there a way to get the ErrorAction to properly be silent?</li>
  </ul>