Find count of how many updates each system requires

This provides a list of all workstations and a count of how many updates they require.

--[SQL Code]
select sys.name0 [Computername],
  --ui.title,
  count(*) Update_Count,
  --ucs.status,
  --SN.StateDescription
  --osd.OSLanguage00 [OS Language],
  osd.Caption00 [OS Name]
from v_updateinfo ui
  inner join v_UpdateComplianceStatus ucs on ucs.ci_id=ui.ci_id
--  join v_CICategories_All catall2 on catall2.CI_ID=UCS.CI_ID
--  join v_CategoryInfo catinfo2 on catall2.CategoryInstance_UniqueID = catinfo2.CategoryInstance_UniqueID and catinfo2.CategoryTypeName='UpdateClassification'
  join v_R_System sys on sys.resourceid=ucs.resourceid
--  join v_StateNames SN on ucs.status = SN.StateID
  join Operating_System_DATA osd on 
	sys.ResourceID = osd.MachineID
    and osd.Caption00 like '%windows%'
    and osd.Caption00 not like '%server%'
    --and ui.title like 'Oracle java % update%'
    and ucs.status='2' -- required
--   and SN.TopicType = 500 --Equivalent to STATE_TOPTCTYPE_SUM_UPDATE_DETECTION
   -- AND ui.articleid='3012973'
  -- order by sys.name0
  group by sys.name0 ,osd.Caption00
  --order by ui.title

Leave a comment