Author Posts

January 1, 2012 at 12:00 am

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

Hello,

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:

Clear-Host
$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]