SCOM Alert Retrieval Performance using PowerShell

I have been doing some work to retrieve alerts from our SCOM environment using PowerShell. I had never worked with SCOM PowerShell before this point, so I went straight to the MS documentation to see what I could find.

My intention was to pull all alerts for the Exchange 2013 Management Pack.

The guide I found was here:

This gave me code which looked like this:

Running it took what seemed an age though. 1 minute 54 seconds. Totally unacceptable.

I noticed however that Get-SCOMAlert is actually very quick though. Investigating the properties that are available in the alerts allowed me to see that the Management Pack ID is returned with the alert. So we can instead turn the query upside down, and get all alerts which have a management pack ID for the pack that we are interested in.

This took a speedy 1.3 seconds – which is absolutely fine.

Most importantly, the results were exactly the same.

Further investigation (albeit limited) seems to point to the bottleneck being in the Get-SCOMClassInstance cmdlet. Whilst important for identifying all systems using a MP, I will be avoiding it as far as I can.

Be the first to like.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.