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
Comments
Anonymous
January 01, 2003
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...Anonymous
January 01, 2003
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. :-)