I have made a script that reads the Windows event log for system/application and does some simple statistics for last 7 days.
Number of errors for the period, as well as number of warnings etc.
—> QUESTION: <—
How to write PowerShell code that shows which Event IDs are the most common? Like a top ten list of warnings/errors or something like that.
Desired output would be something like this:
2019-07-22 ; 2019-07-15 ; EventID; 55 ;Frequency; 102
2019-07-22 ; 2019-07-15 ; EventID; 123 ;Frequency; 56
2019-07-22 ; 2019-07-15 ; EventID; 32 ;Frequency; 34
Start-date ; end-date ; EventID; XX ; Frequency ; YY
(*) Frequence just means number of hits/occurences for that specific event-id. The top 5 or so would do just fine. But I need to measure out exactly which event id is the most common/hast the most hits/highest frequency/most occurences
What I have done so far is a foreach that counts up the event-id with increments of 1 at a time - but that is not very elegant and is way to slow (considering that theoretically the range would be 1-65535)
Have a nice day!