Windows Client / Server - Find Latest Installed OS Cumulative Update or OS Security Monthly Quality Rollup - Monthly Rollup

Hi,

A customer wanted to show the Latest Installed OS Cumulative Update or OS Security Monthly Quality Rollup - Monthly Rollup on each Windows OS Computer

From my Understating The following terminology applies -
For Windows Clients - Until Windows 8.1 | For Windows Servers - Until Windows Server 2012 R2 - Security Monthly Quality Rollup - Monthly Rollup
From Windows 10 and Server 2016 - Cumulative Update

First I’ve tried to locate where that information is written down on the OS Itself - I’ve tried the following solution

  • Locate keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages that have the following criteria: “InstallName” contains “Package_for_RollupFix” AND “CurrentState” equals 112. from that extract the KB portion on “InstallName” value

I’ve created the following relevance statement:

(it as string) of matches (case insensitive regular expression “KB[[:digit:]]*”) of ((it as string) of values “InstallLocation” of keys whose (value “InstallName” of it as string contains “Package_for_RollupFix” AND value “CurrentState” of it = 112) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages” of native registry)

At first, It showed the results I wanted but I’ve encountered “none” results on few machines

So I’ve thought about a solution using the Win32_QuickFixEngineering WMI Class -

  1. Get All of the Installed Updates with the Win32_QuickFixEngineering WMI Class and extract only the KB portion - No problem getting that information
  2. Get all of the “Enterprise Security” fixlets that contain “Cumulative Update for [CURRENT_OS] - [CURRENT_OS] - KB” OR “Security Monthly Quality Rollup - Monthly Rollup - [CURRENT_OS] - KB”
  3. create an intersection between them and get the KB that is installed

Just for testing, I’ve created the following relevance statement:
elements of intersection of (set of ("INSTALLED_KB");set of ("KB_FROM_SITE"))
example:

elements of intersection of (set of (“KB4580328”;“KB4093109”);set of (“KB4093109”;“KB4093103”))

answer: KB4093109

Now I’ve also created a relevance statement that will create the right strings for item 2:
example:

(unique value of tuple string items 0 of it, unique value of tuple string items 1 of it) of concatenations “, " of unique values of ((item 0 of it & item 1 of it & " - KB”) of ((“Cumulative Update for “;“Security Monthly Quality Rollup - Monthly Rollup - “),(match (case insensitive regex “Windows[ Server][ [:digit:]][ R2]*”) of (if (exists wmi AND (not (name of operating system = “WinME” ))) then (string value of selects “caption from win32_operatingsystem” of wmi & " " & csd version of operating system) else ( “Windows " & (following text of first “Win” of (name of operating system as string)) & (if (name of operating system = “WinNT” ) then ((if (exists key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” whose (exists value “ProductType” of it AND (value “ProductType” of it as string as lowercase = “servernt” OR value “ProductType” of it as string as lowercase = “lanmannt” )) of registry) then (if (exists key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” whose (exists value “ProductSuite” of it AND value “ProductSuite” of it as string as lowercase contains “terminal” ) of registry) then " Terminal Server” else " Server” ) else " Workstation” ) & " " & csd version of operating system) else (if (name of operating system = “Win98” ) then (if (csd version of operating system as string contains “A” ) then " Second Edition” else “” ) else (if (name of operating system = “Win95” ) then (if (csd version of operating system as string contains “C” OR csd version of operating system as string contains “B” ) then " OSR2” else “” ) else " " & csd version of operating system ))))) as trimmed string)))

answer: Cumulative Update for Windows Server 2016 - KB, Security Monthly Quality Rollup - Monthly Rollup - Windows Server 2016 - KB

Now I’ve got issues with getting those strings to the relevance statement that will search on the “Enterprise Security” site… :slight_smile:

Do you have any other solutions for the requested information AND/OR help with relevance statement

Thanks :slight_smile:

1 Like