Updated: Enhanced SCOM Alerts Notification Emails script

I’d like to thank everyone who have tested it and provided feedbacks. You made me aware there are few issues and bugs with the script. Since I have just resigned and my new job won’t start in few weeks time, I have spent the last couple of days updating the script.

This is what I’ve done:

1. Removed GetNetbiosName function

Few people advised there are often this function running into errors. I realised I originally wrote this function because one of my previous employers required the SCOM agent NetBios name in the email. but since SCOM is designed to monitor applications and objects rather than individual servers, I don’t see any reasons to include Computer NetBIOS name in the email. For sure it will often fail if the alert source is from a AD Site or distributed application, etc.

Instead, I’ve added Alert Source, Path and Principal name in the email.

P.S. I’ve also rewritten the function, trying to fix the bug. I’ve still left the

function in the script (but commented out). Feel free to use it somewhere else.

2. Reformatted HTML email body

I have changed the format of few items from <h3> (header 3) to just <b> (bold) to make the email more readable.

I also made the alert severity more visual: Critical is displayed in Red, Warning displayed in Yellow and information displayed in Blue (if you subscribe informational alerts)

3. Added error handling for $rule.GetKnowledgeArticle() as sometimes there is no knowledge article.

I often get error emails because GetKnowledgeArticle() method returns error. This is because not all rules and monitors will have knowledge articles associated to them. I have added few lines of code to handle errors occurred when calling this method. basically if calling this method failed, it will remove the entry from $error.

Post navigation

5 comments

I was reading your post and on ENHANCED SCOM Alerts Notification Emails!
and on the last part of it you said “One last thing to remember: The powerShell execution policy on your RMS needs to set to RemoteSigned or Unrestricted.” How can I do this? I am new to SCOM 2007 and am finding a way to send alert via second channel notification.
Thank you.

Hi Manish, I think this might be performance related. is your RMS and SQL servers experiencing performance issues? also, have you tuned all your MPs? what’s the time frame for SCOM to generate those 500 alerts?