title: How to set up Powershell where-object for filtering EventLog
body: <p>In interactive mode, this works: </p>
  
  <pre><code>Get-Eventlog -log application -after ((get-date).addMinutes(-360)) -EntryType Error
  </code></pre>
  
  <p>Now I want to filter out certain messages, the following didn't filter the desired word: </p>
  
  <pre><code>Get-Eventlog -log application -after ((get-date).addMinutes(-360)) -EntryType Error | where-object  {$_.$Message -notlike "*Monitis*"}
  </code></pre>
  
  <p>Also, how do I put in multiple conditions on the where-object? </p>
  
  <p>In my script, I'm getting errors on the -and statement: </p>
  
  <pre><code>$getEventLog = Get-Eventlog -log application -after ((get-date).addMinutes($minutes*-1)) -EntryType Error 
  # list of events to exclude 
  $getEventLogFiltered = $getEventLog | where-object {$_.Message -notlike "Monitis*" 
                                         -and $_.Message -notlike "*MQQueueDepthMonitor.exe*"
                                         }
  $tableFragment = $getEventLogFiltered | ConvertTo-Html -fragment
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>-and : The term '-and' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
  the spelling of the name, or if a path was included, verify that the path is correct and try again.
  At D:\scripts\EventLogExtract2.ps1:24 char:40
  +                                        -and $_.Message -notlike "*MQQueueDepthMo ...
  +                                        ~~~~
  </code></pre>