Operations Manager Command Shell Main Menu
Welcome to TechNet Blogs Sign in | Join | Help
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 {$_.name}}} | sort-object count –desc

command shell main menu

Posted: Saturday, April 25, 2009 3:10 AM by jtalmquist

Comments

dmuscett said:

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 http://www.muscetta.com/2008/01/25/looking-at-opsmgr2007-alert-trend-with-command-shell/

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

# April 25, 2009 12:26 PM

jtalmquist said:

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

# April 25, 2009 1:29 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker