Top 10 Events

This will return the top ten events collected.

FYI – Given the sheer number of events collected and stored in the OperationsManager database, this query may take a minute to return results.

$array = @();foreach ($number in Get-Event | foreach-object {$_.get_number()}) {$array += $number};$array | Group-Object | select-object -first 10 count,@{name="Event Number";expression={foreach-object {$}}} | sort-object count –desc

command shell main menu

Comments (2)

  1. a minute?

    Get-Event simply gets ALL events in the OpsDB. your loop will load them into an array… for the purpose of sorting/grouping,etc…

    I have tried this simple approach a while ago

    Powershell IS very cool, but for this type of bulk extraction you should really go TSQL…

    I have seen this thing throwing an OUT OF MEMORY exception even on SMALL environments with just 50 agents and the default grooming of 7 days…

  2. Yes.  I believe you there.  Initially, I didn’t post any get-event cmdlets, because of the issue you describe.  But, I want the main reference table to be complete.  So there it is…the get-event cmdlet in use. 🙂