title: Get-Aduser -Filter will not accept a variable
body: <p>I'd like to check if a user account already exists in the system.</p>
  
  <pre><code>$SamAc = Read-Host 'What is your username?'
  $User = Get-ADUser -Filter {sAMAccountName -eq "$SamAc"}
  </code></pre>
  
  <p>I'm not sure why, but <code>$User</code> will always return null even if <code>{sAMAccountName -eq "$SamAc"}</code> is supposed to be true.</p>
  
  <p>What am I missing here?</p>
  
  <p>Edit:</p>
  
  <p>This is what was missing:</p>
  
  <pre><code>$User = Get-ADUser -Filter "sAMAccountName -eq '$SamAc'"
  </code></pre>
  
  <p><sup><strong>Editor's note:</strong> The <em>script block</em> (<code>{ ... }</code>) was replaced with a <em>string</em>. </sup></p>