title: Generate Inactive user report with some exclusions - Powershell
body: <p>I am writing up a script to generate a list of inactive users at both of our office locations. Some of these inactive users will be on Maternity leave, so we put the keyword "Maternity" in their AD description field. I would like for the script to EXCLUDE anyone with that keyword from the report, but I appear to be having issues with piping the info around correctly.</p>
  
  <pre><code>Search-ADAccount -UsersOnly -SearchBase $LondonOU -AccountInactive -TimeSpan 90.00:00:00 | Get-ADUser -Filter * -Properties Description | where {($_.enabled -eq $false) -and ($_.description -notcontains "Maternity")} | Sort LastLogonDate |
  </code></pre>
  
  <p>The above is what I am using now and it works for showing me the inactive users. I just cannot get it to exclude the Maternity keyword users.</p>
  
  <p>Thank you!</p>