Getting unique event log messages

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 4 months ago.

  • Author
  • #5882

    by peterw at 2013-05-02 06:59:18


    I'm trying to write a script that creates a csv with eventlog messages. It should display each message only once, it should not look at the date/time.
    So if there are 20 entries with eventid 123 and message xyz and 30 entries with eventid 456 and message abc,
    I want 1 record with eventid 123 and message xyz and 1 record with eventid 456 and message abc .
    I tried the following but that did not work, it only showed 1 record on my pc:

    $SysEvent = Get-Eventlog -Logname system -Newest 2000
    $SysError = $SysEvent | Where {$_.entryType -Match "Error"}
    $SysError | Sort-Object EventID |select -Unique
    Format-Table EventID, Source, TimeWritten, Message -auto

    Does anybody has an idea?

    Thanks Peter

    by Klaas at 2013-05-02 07:36:12

    Something like this]Get-EventLog system -Newest 2000 -EntryType error | Group-Object eventid,message | Select count, name | Format-List[/powershell]

You must be logged in to reply to this topic.