title: How to use a variable in a filter parameter?
body: <p>I am trying to pull some properties from the bitlocker active directory object, which I can do just fine using PowerShell and typing all the info in. for  example</p>
  
  <pre><code>Get-ADObject -filter 'CN -like "*A3F850A4*"' `
               -Properties CanonicalName,msFVE-RecoveryPassword
  </code></pre>
  
  <p>Works just fine to pull the properties, but I can't figure out how to use a variable in -filter parameter and get it to return any info, this is the code I have tried. </p>
  
  <pre><code>[string]$passwordId = Read-Host `
                    "What is the first 8 charcters of the recovery password id?"
  Get-ADObject -filter {CN -like $passwordId} ` 
               -Properties CanonicalName,msFVE-RecoveryPassword
  </code></pre>
  
  <p>Any help would be greatly appreciated, especially any info on using variables in scripts. Thanks.</p>