I am trying to format a command that searches the Event Logs on the server for a particular string, but I want it to search for Critical, Warning, and Error logs entries.
Right now, I only know how to make it search one error type or the other, for example like this:
Get-EventLog -LogName Application -EntryType Error -Message *STRING* -Newest 5 |
Format-List
This below isn't working but is along the lines of what I'm trying to do:
Get-EventLog -LogName Application |
Where {$_.EntryType Error -or $_.EntryType Warning -or $_.EntryType Crital} -and -Message *STRING* -Newest 5 |
Format-List
This doesn't work and not being very adept at Powershell I'm not quite sure how I should be formatting this command. Other OR statements I've found examples of use IF, but I don't see why I need an IF statement in my case.