Monday, November 2, 2015

The Power Of The Community & PowerShell

Some history
A long time ago Jason Rydstrand wrote an excellent PS script for creating a HTML based Health Check Report for a SCOM 2007x environment, to be found here. This PS script enabled one to have a quick overview of the health of their SCOM 2007x environment. It worked like a charm and used quite a few times.

When SCOM 2012 saw the light, fellow MVP Scott Moss rewrote that PS script for SCOM 2012x. And again, it worked like a charm and I used it on many occasions.

Time to add my own ‘ingredients’…
However, I personally thought some additional information was lacking. So I decided to add those sections to the existing PS script in order to obtain a SCOM 2012x Health Check Report with even more information.

Mind you, this isn’t any kind of criticism. It’s always easier to add some lines of code to an existing PS script than to write it from the ground. So all respect AND credits go to Jason Rydstrand and Scott Moss for that matter.

What I added/modified
First off, this PS script has a section which mails it to one or more recipients by using a Gmail account. However, many customers of mine don’t have many internal servers with an internet connection, so this section has been commented out. It’s still available, but it won’t work without some help from you.

Instead this PS script creates a HTML file and saves it to a location as defined in the PS code. In this PS script the location is set to ‘C:\Server Management’. In many occasions it’s better to replace it with a UNC path…

Also the Report gets a file name based on the date (YYYYMMDD. example: 20151102) AND time (HH-MM-SS example: 19-31-52) this Report is run. So when run multiple times, every report file will get a unique name, so nothing gets overwritten. On top of it all, the file name will also reflect the name of the Management Group this Report is about. Example of a report name: 20151102_19-31-52 _SCOM Health Check Report MG OM12.html.

Therefore this PS script is ideal for scheduling it using Task Scheduler or similar tools.

Other stuff I added:

  1. Generic Information section
    This section contains the name of the report file, the location and when it’s created. Also it contains more information about the Management Group: the name of the MG, the number and names of the MS & GW servers, and the number of SCOM Agents. Also the name of the company is shown (replace XYZ in the PS code with the correct company name). Example:
    image
  2. Top 10 Rule Based Closed Alerts
    Personally not only the non-closed Alerts help me tuning a SCOM environment, but also the CLOSED ones. Therefore an additional section has been added showing the Top 10 of the Closed Alerts, based on Rules. Example:
    image
  3. Top 10 Monitor Based Closed Alerts
    Same story, but now for Monitor based closed Alerts. Example:
    image
  4. Report Creation Time
    I want to know how long it took to have this HTML report created. So I use the .NET Stopwatch class in order to obtain that information. Example:
    image

Where to obtain this PS script?
You can download it from my OneDrive.

Credits
Again, this PS script hasn’t been created by myself. Instead Jason Rydstrand wrote the PS script for SCOM 2007 and Scott Moss rewrote it for SCOM 2012x. I just added some additional stuff, that’s all. So all credits go to Jason Rydstrand and Scott Moss.

When you think you can add some use full code as well, feel free to do so. Contact me and I will update this posting accordingly. Sharing is Caring!

1 comment:

CitrixDude said...

Glad to hear it is working for you Marnix!