Command Shell Examples
Useful SQL Queries
Top 10 Events - Jonathan Almquist on Operations Manager - Site Home - TechNet Blogs

Top 10 Events

Top 10 Events

  • Comments 2
  • Likes

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

I do not moderate this blog anymore. If you have a question regarding this post, send me a message.

  • 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...

  • 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. :-)