Analysis to list Hotfixes installed using WMI

(imported comment written by SystemAdmin)

you can try this, it doesn’t use WMI so it’s much much faster 19ms vs 709ms

if ((name of it = 
"Win98" OR name of it = 
"WinME") of operating system) then (names of keys whose (exists value 
"UninstallString" of it AND (value 
"UninstallString" of it as string contains 
"RunDll32 advpack.dll,LaunchINFSection")) of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry) 

else 

if (name of operating system = 
"WinNT") then (names of keys whose (exists value 
"UninstallString" of it AND (value 
"UninstallString" of it as string contains 
"hotfix.exe")) of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry) 

else 

if ((name of it = 
"Win2000" OR name of it = 
"WinXP" OR name of it = 
"WinXP-2003" OR name of it = 
"Win2003") of operating system) then (names of keys whose ((exists value 
"UninstallString" of it) AND (value 
"UninstallString" of it as string contains 
"spuninst.exe") AND (name of it as string does not contain 
"Service Pack")) of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of 

native registry) 

else 

if ((name of it = 
"WinVista" OR name of it = 
"Win2008" OR name of it = 
"Win2008R2" OR name of it = 
"Win7") of operating system) then (elements of ((set of (

if (exists key 
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" of 

native registry) then elements whose (it contains 
"KB" AND it does not contain 
"_") of ((set of ((substrings before 
"~" of substrings after 
"for_" of names of keys whose (name of it contains 
"for_") of key 
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" of 

native registry) as uppercase)) - (set of (
"KB936330";
"KB948465"))) 

else (nothing))))) 

else (
"Not Supported")

As far as your query I get an error

Q: if (exists wmi) then ((string value of property “HotFixID” of it, string value of property “Description” of it) of select objects “HotFixID, Description from Win32_QuickFixEngineering” of wmi) else (“N/A”)

E: Incompatible types.

Q: if (exists wmi) then ((string value of property “HotFixID” of it, string value of property “Description” of it) of select objects “HotFixID, Description from Win32_QuickFixEngineering” of wmi)

as string

else “N/A”

A: KB958830, Update

A: KB971033, Update

A: KB2032276, Security Update

T: 709.216 ms

your query could be changed to exclude the ‘File 1’ depending if its the HotFixID or Description you will need to update the Query

if (exists wmi) then ((string value of property “HotFixID” of it, string value of property “Description” of it) of select objects "HotFixID, Description from Win32_QuickFixEngineering where

HotFixID

!= ‘File 1’" of wmi) as string else (“N/A”)

1 Like