Thursday, August 20, 2015

PowerShell: HTML Reports UR Level SCOM Agents

When running a SCOM environment, it’s already a bit of a challenge to apply an Update Rollup (UR) package. And this challenge is mostly caused by the fact that EVERY monitored Windows system has to be ‘touched’ because the Microsoft Monitoring Agent (MMA) requires that UR.

So Change Management is required. But even when the related RFC’s have passed the CAB, another challenge remains: WHICH Windows systems are patched, and which aren’t?

Yes, the SCOM Console has a nice view all about the patch level of the MMAs. But making a quick count of those systems (which are and which aren’t updated) can take some time which could be spend better. And the bigger your SCOM environment, the more time it takes.

Again: PowerShell to the rescue!
Gladly enough there is PowerShell. And with some basic PS scripting a lot can be achieved.

So I’ve made a PS script which queries the SCOM MG for ALL the MMAs and their UR level. These results are piped into TWO HTML reports: one containing all the MMAs not on the expected UR level and the second one containing all the MMAs on the expected UR level.

In order to visualize it even better, both reports use other formatting by using two different CSS files. Both reports show additional information on the MMA’s as well:

  1. Version level;
  2. Patch List;
  3. Whether the MMA is manually installed or not.

Some examples
The HTML report containing the MMAs NOT on the expected UR level:

The HTML report containing the MMAs on the expected UR level:

What it needs in order to run
Besides the obvious (it must be run from a system where the SCOM 2012x Console is installed AND under an account which has SCOM permissions), this PS script requires only two inputs from you:

  1. The FQDN of the SCOM 2012x Management Server to connect to:
    Line 9, replace <FQDN OF THE SCOM 2012 MS SERVER> with the MS server of your SCOM MG.

  2. The UR Level to check for.
    Line 114, replace the number (6 in this example) with the UR level to check for.

That’s all there is to it. And to make it easier, the HTML files have the name of the Management Group it touched and the UR level checked for. Also the MG name and UR level checked for are displayed in the HTML reports themselves.

Script can be downloaded from here.

This PS script is tested only in SCOM 2012 R2. It should work in SCOM 2012 SP1/RTM as well but it hasn’t been tested.

No comments: