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 {$_.name}}} | 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.

Comments
  • <P>a minute?</P> <P>Get-Event simply gets ALL events in the OpsDB. your loop will load them into an array... for the purpose of sorting/grouping,etc...</P> <P>I have tried this simple approach a while ago <A href="http://www.muscetta.com/2008/01/25/looking-at-opsmgr2007-alert-trend-with-command-shell/" target=_new rel=nofollow>http://www.muscetta.com/2008/01/25/looking-at-opsmgr2007-alert-trend-with-command-shell/</A></P> <P>Powershell IS very cool, but for this type of bulk extraction you should really go TSQL...</P> <P>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...</P>

  • <P>Yes. &nbsp;I believe you there. &nbsp;Initially, I didn't post any get-event cmdlets, because of the issue you describe. &nbsp;But, I want the main&nbsp;reference table to be complete. &nbsp;So there it is...the get-event cmdlet in use. :-)</P>