Visualize Windows Update info (from SCCM) in Squared Up

By | November 12, 2019

Hi,

Today I want to show you guys a nice example of how we can use custom scripts to visualise data coming from SCCM in Squared Up dashboards on top of a SCOM platform. And provide a strong integration between SCCM, SCOM & Squared Up.

Squared Up is my favorite tool to create dashboards, check it out here: https://demo.squaredup.com 

I’m currently in the process of setting up a brand new SCOM 1801 environment at a customer and an SCCM CB environment at the same customer with the focus on servers and server patching. The customer wanted also an easy way to check the following parameters:

  • How many updates are pending on each server?
  • Is there a pending reboot due to the installation of Windows Updates?
  • When was the server last updated? And what Windows Updates have been applied then?
  • Are there any maintenance windows applied to a server?

Lots of questions to be answered! All this information can be found somewhere hidden in the SCCM reporting or we could create some custom reports containing that info. However, due to the fact I’m not a SQL reporting guru I wanted to see if we could show all this information in an easy way using Squared Up. As all the servers also have a SCOM agent installed we could get our information directly from there. And I have to say, it was really fun and easy to do!

I’ve used some custom powershell scripts which I added as SCOM tasks, these tasks are then added to a “Windows Updates” perspective I created for each Windows Computer object and this is the result:

All the components you see in the above perspective are based on powershell scripts put in SCOM tasks.

The “Pending Updates” counter is a custom performance counter reading information from WMI, this is the script:

# Any Arguments specified will be sent to the script as a single string.
# If you need to send multiple values, delimit them with a space, semicolon or other separator and then use split.
param([string]$Arguments)

$ScomAPI = New-Object -comObject “MOM.ScriptAPI”

# Collect your performance counter here. Note that in order to support the DW this script MUST only return a single
# object/counter and those must be static values. You can return multiple instances just fine though.

$Instances = @(“Total”)
$Metric = @(Get-WmiObject -Class CCM_SoftwareUpdate -Filter ComplianceState=0 -Namespace root\CCM\ClientSDK).Count

Foreach ($Instance in $Instances)
{
$PropertyBag = $ScomAPI.CreatePropertyBag()
$PropertyBag.AddValue(“Metric”, $Metric)
$PropertyBag.AddValue(“Total”,$Instance)

# Send output to SCOM
$PropertyBag
}

On top of the perspective I’ve also added a button to install all pending updates directly from the dashboard without having to logon to the server and start the installation from Software Center. When clicking the button, Software Center kicks of the installation within minutes.

There is also an additional dashboard where they can review the servers with the most updates pending (top 20) per domain.

To finish things of I added some of the above information to the “Windows Server” perspective as well. In this way the customer can immediately see additional info (highlighted in red in the below screenshot):

  • How many pending updates?
  • When was the server last rebooted?
  • Is there a pending reboot due to Windows Updates?
  • If the server is a VM, what is the Hyper-V host the VM is running on?

Now they are using Squared Up as the go to tool for reviewing the health of the environment and for following-up on patching!

If you would like to accomplish the same or have any questions, please feel free to drop a comment below and I’ll be happy to share my scripts.

Hope this helps!

Best regards,

Bert

2 thoughts on “Visualize Windows Update info (from SCCM) in Squared Up

  1. Rinku Garg

    Hi Bert,

    Really this is good stuff.

    Could you please share the scripts and how I can I achive same in my environment?
    Is this paid or freeware for users?

    Reply
    1. bert@bpitconsulting.be Post author

      Hi,

      You can reuse my scripts as I also found some parts roaming around the internet :).
      To set this up in your environment you will need at least SCCM and SCOM. To visualise everything on dashboards you will need Squaredup (https://www.squaredup.com).
      The script to collect “Pending Updates” as a performance counter is available in the post, so you can copy/paste it from there.
      What other scripts are you interested in?
      This is the script from the task “install pending updates” (this basically queries WMI on the destination server)

      # This is a simpple get of all instances of CCM_SoftwareUpdate from root\CCM\ClientSDK
      $MissingUpdates = Get-WmiObject -Class CCM_SoftwareUpdate -Filter ComplianceState=0 -Namespace root\CCM\ClientSDK

      # The following is done to do 2 things: Get the missing updates (ComplianceState=0)
      # and take the PowerShell object and turn it into an array of WMI objects
      $MissingUpdatesReformatted = @($MissingUpdates | ForEach-Object {if($_.ComplianceState -eq 0){[WMI]$_.__PATH}})

      # The following is the invoke of the CCM_SoftwareUpdatesManager.InstallUpdates with our found updates
      # NOTE: the command in the ArgumentList is intentional, as it flattens the Object into a System.Array for us
      # The WMI method requires it in this format.
      $InstallReturn = Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList (,$MissingUpdatesReformatted) -Namespace root\ccm\clientsdk

      Best regards,
      Bert

      Reply

Leave a Reply to Rinku Garg Cancel reply

Your email address will not be published.