KBs Installed line by line with hostname

Hi

Actually we are using a propertie “Uninstallable Patches and Updates”. In which we can see the KBs installed in Windows machines.

But wintel team is requesting other format to show the information.

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” OR name of it = “Win8” OR name of it = “Win2012” OR name of it = “Win8.1” OR name of it = “Win2012R2”) of operating system) then (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_” AND value “Visibility” of it = 1 AND (it = 96 or it = 112 or it = 6 or it = 7) of (value “CurrentState” of it as integer)) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages” of native registry) as uppercase) + set of ((it as string as uppercase) of values “DisplayName” of keys whose (value “DisplayName” of it as string starts with “KB” AND exists value “Uninstallable” of it AND value “Uninstallable” of it = 1) of keys “Patches” of keys of keys “Products” of keys whose (exists key “Products” of it) of key “HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData” of native registry) - set of (“KB936330”;“KB948465”)) else (nothing)) else (“Not Supported”)

The format requeste is show in a line the hostname and the kb isntalled. actually we show in webreport

Client, Hostname, OS and KBs installed ( KBs all in the same box)
Really I don’t know how to add to this properti the possibility to get hostname beside the KB.

Thanks in advance for your help

Sorry clarification

The propertie used is :smile:
unique values of (if (it contains “_”) then (preceding texts of firsts “RTM” of it) else it ) of preceding texts of firsts “~” of following texts of firsts “for” of (name of it as trimmed string) of keys whose (name of it contains “KB”) of keys ( “HKEYLOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;“HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages”;“HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Hotfix”) of (x32 registries;x64 registries) as string

and it shows the results as follow:

A: KB2249857
A: KB2284742
A: KB2305420
A: KB2388210
A: KB2393802
A: KB2447568
A: KB2533552
A: KB2545698
A: KB2547666
A: KB2556532
A: KB2603229
A: KB2644615
A: KB2667402
A: KB2676562
A: KB2679255
A: KB2698365
A: KB2724197
A: KB2729094
A: KB2761217
A: KB2799494
A: KB2807986
A: KB2853952
A: KB2862330
A: KB2862335
A: KB2879017
A: KB2908783
A: KB2909210
A: KB2977629

Ok, then what would like to know is how concatenate the hostname to output follows

A: KB2249857 | hostname
A: KB2284742 | hostname

Please can you help ?

try something like this,

(unique values of (if (it contains “”) then (preceding texts of firsts “RTM” of it) else it ) of preceding texts of firsts “~” of following texts of firsts “for” of (name of it as trimmed string) of keys whose (name of it contains “KB”) of keys ( "HKEYLOCALMACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";“HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages”;“HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Hotfix”) of (x32 registries;x64 registries)) as string, computer name

1 Like