Checking if CU5 for SCOM 2007 R2 has been applied successfully

During the past year I have seen several requests from people in the community on how they can check if their servers have successfully applied a certain Cumulative Update. Lately I had a requirement to create some test scripts to determine if CU5 has been applied for the RMS (including SQL scripts and management pack import), Management servers, gateways and web console servers. So I set out to create scripts for this and make them general enough to share. 💡
As you probably know its much easier to have a quick check for agent updates from the SCOM console. I did not include the ACS server check for the moment. This post and set of scripts is specifically for CU5, but I will post the same for CU6 today in another post. Idea is the same, scripts are on a different link. The scripts can not cover a 100% of all possible things to check, but I think we get far enough this way B)
Thus far I have tested the scripts in a few environments and have generalized them as much as possible, finding information we need from the system itself. I am sure others with more PowerShell skills can do this in fewer lines of code, but I have tried my best. Any comments are welcome of course.
The CU5 check scripts for SCOM 2007 R2 are in a zip file on the TechNet Gallery to be found through this link.

  1. You download the zip file and extract it somewhere on the machine you want to check (RMS, MS, GW, Web).
  2. Log onto the machine with the account you used to install the CU. Reason is that the script is trying to find the CU install log files in the temp folder in your profile, if it can not find it there it will give an error and skip to the next checking steps.
  3. Open an elevated command prompt en go to the folder where the scripts are located.
  4. Run one of the .cmd files belonging to the server role you have installed:
    TestSCOMRootMSCU5.cmd for the RMS (This also checks the SQL scripts and MP import you did right after RMS upgrade)
    TestSCOMMSCU5.cmd for a Management Server (not the RMS)
    TestSCOMGWCU5.cmd for a Gateway
    TestSCOMWebCU5.cmd for a Web Console server
    If you run the Web Console on a management server or the RMS than you simply run both scripts needed for that machine.
  5. Check the output for Errors. I have made the scripts stop after it found an error in some stage, except if it can not find the install log files. Errors are marked with [ERROR] and are in red. Am listing some examples below.

I tried to document the steps and checks we do in the script itself. Different roles have some different checks associated with them.
Below is an example where first a RMS check was run and finished with success. Next piece was what happens if you run two of the scripts on the box for a role it doesn’t have (it gives an error :roll:). Next we run the web console checking script which starts out and finishes successfully.
And yes, this happens to be the screenshot for CU6. B)

So that is it. It should cover most scenarios.
The next post will be the same for CU6 and point back to this one on how to run it.
Also I want to extend a word of thanks to Marius van de Ven, whom I bothered a few times with some specific questions on how to do stuff in PowerShell.
Enjoy and good luck!
Bob Cornelissen