SOLVED

System Updates queries, how to find counts and list machines

%3CLINGO-SUB%20id%3D%22lingo-sub-653116%22%20slang%3D%22en-US%22%3ESystem%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653116%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I'm%20trying%20to%20make%20a%20bunch%20of%20queries%20%2B%20new%20dashboard%2C%20that%20is%20similar%20to%20the%20built-in%20queries%20in%20the%20System%20Update%20Assessment%20in%20Azure%20LogAnalytics.%20But%20I%20simply%20don't%20know%2C%20how%20I%20can%20make%20the%20right%20queries.%20I%20have%20tried%20to%20describe%20the%20needed%20queries%20below.%20Does%20anyone%20have%20something%20they%20would%20share%20with%20me%20-%20or%20similar%20queries%2C%20which%20can%20inspire%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20customer%20has%20made%20their%20own%20definitions%2Fgrouping%3A%3C%2FP%3E%3CP%3E%2F%2F%20%3CSTRONG%3ECRITICAL%20NON-SECURITY%20UPDATES%20(monthly)%3C%2FSTRONG%3E%3A%20Critical%20Updates%3CBR%20%2F%3E%2F%2F%20%3CSTRONG%3EIMPORTANT%20SECURITY%20UPDATES%20(monthly)%3C%2FSTRONG%3E%3A%20Security%20Updates%2C%20Security-only%20update%2C%20Update%20Rollups%2C%20Monthly%20Rollups%3CBR%20%2F%3E%2F%2F%20%3CSTRONG%3EIMPORTANT%20FEATURE%20UPDATES%20(planned)%3C%2FSTRONG%3E%3A%20Feature%20Packs%2C%20Updates%2C%20Servicing%20Stack%20Updates%2C%20Upgrades%2C%20Service%20Packs%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%2F%20Output%3A%20Pie%20Chart%2F%2F%20Need%20Critical%20Updates%20%3D%20CriticalUpdatesCountTotal%2F%2F%20Need%20Important%20Security%20Updates%20%3D%20SecurityUpdatesCountTotal%2F%2F%20Need%20Important%20Feature%20Updates%20%3D%20FeatureUpdatesTotal%2F%2F%20Up%20to%20date%20%3D%20NoPendingTotal%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-------------------------------%3C%2FP%3E%3CP%3EBasically%20I%20want%20to%20find%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3Enumber%20of%20machines%2C%20which%20has%20CRITICAL%20NON-SECURITY%20UPDATES%20pending%2C%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20this%20months%20updates%3C%2FLI%3E%3CLI%3Enumber%20of%20machines%2C%20which%20have%20IMPORTANT%20SECURITY%20UPDATES%20pending%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20this%20months%20updates%3C%2FLI%3E%3CLI%3Enumber%20of%20machines%2C%20which%20have%20IMPORTANT%20FEATURE%20UPDATES%20pending%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20this%20months%20updates%3C%2FLI%3E%3CLI%3Enumber%20of%20machines%2C%20which%20have%20NO%20pending%20updates%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20this%20months%20updates%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CEM%3EHints%20%3F%3F%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%2F%2F%20Query%201%3A%20Count%20of%20machines%20(dashboard)%3CBR%20%2F%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%3CSTRONG%3E%2F%2F%20find%20all%20Windows%20updates%20-%20excluding%20Definition%20Updates%20and%20Drivers%3C%2FSTRONG%3E%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%20and%20Classification%20!%3D%20%22Definition%20Updates%22%20and%20Classification%20!%3D%20%22Drivers%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%2F%2F%20Find%20newest%20updates%20entries%20per%20computer%3C%2FSTRONG%3E%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CSourceComputerId%2CUpdateID%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%2F%2F%20Summarize%20number%20of%20machines%2C%20which%20has%20CRITICAL%20NON-SECURITY%20UPDATES%20pending%2C%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20ths%20months%20updates%3C%2FSTRONG%3E%3CBR%20%2F%3ECriticalUpdatesCountTotal%20%3D%20UpdateState%3D~%22Needed%22%20and%20Approved!%3Dfalse%20and%20Classification%20contains%20%22Critical%20Updates%22%20and%20PublishedDate%20%26lt%3B%20now(-31d)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%2F%2F%20Summarize%20number%20of%20machines%2C%20which%20have%20IMPORTANT%20SECURITY%20UPDATES%20pending%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20ths%20months%20updates%3C%2FSTRONG%3E%3CBR%20%2F%3ESecurityUpdatesCountTotal%20%3D%20UpdateState%3D~%22Needed%22%20and%20Approved!%3Dfalse%20and%20(%20(Classification%20contains%20%22Security%20Updates%22)%20or%20(Classification%20contains%20%22Rollups%22)%20)%20and%20PublishedDate%20%26lt%3B%20now(-31d)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%2F%2F%20Summarize%20number%20of%20machines%2C%20which%20have%20FEATURE%20UPDATES%20pending%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20ths%20months%20updates%3C%2FSTRONG%3E%3CBR%20%2F%3EFeatureUpdatesTotal%20%3D%20UpdateState%3D~%22Needed%22%20and%20Approved!%3Dfalse%20and%20(%20(Classification%20contains%20%22Feature%20Packs%22)%20or%20(Classification%20%3D%3D%20%22Updates%22)%20or%20(Classification%20%3D%3D%20%22Upgrades%22)%20or%20(Classification%20contains%20%22Service%20Packs%22)%20)%20and%20PublishedDate%20%26lt%3B%20now(-31d)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%2F%2F%20Summarize%20number%20of%20machines%2C%20which%20have%20NO%20pending%20updates%20which%20are%20more%20than%201%20months%20old%20to%20exclude%20ths%20months%20updates%3C%2FSTRONG%3E%3CBR%20%2F%3ENoPendingTotal%20%3D%20UpdateState%3D~%22Needed%22%20and%20Approved!%3Dfalse%20and%20(%20(Classification%20contains%20%22Feature%20Packs%22)%20or%20(Classification%20%3D%3D%20%22Updates%22)%20or%20(Classification%20%3D%3D%20%22Upgrades%22)%20or%20(Classification%20contains%20%22Service%20Packs%22)%20)%20and%20PublishedDate%20%26lt%3B%20now(-31d)%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3E%2F%2F%20Output%3A%20Pie%20Chart%3C%2FSTRONG%3E%3CBR%20%2F%3E%2F%2F%20Need%20Critical%20Updates%20%3D%20CriticalUpdatesCountTotal%3CBR%20%2F%3E%2F%2F%20Need%20Important%20Security%20Updates%20%3D%20SecurityUpdatesCountTotal%3CBR%20%2F%3E%2F%2F%20Need%20Important%20Feature%20Updates%20%3D%20FeatureUpdatesTotal%3CBR%20%2F%3E%2F%2F%20Up%20to%20date%20%3D%20NoPendingTotal%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%2F%20----------------------------------------------------------------------------------%3C%2FP%3E%3CP%3E%3CSTRONG%3EQuery%202%3A%20List%20of%20machines%20which%20has%20CRITICAL%20NON-SECURITY%20UPDATES%20pending%2C%20which%20are%20more%20than%201%20months%20old%3C%2FSTRONG%3E%3CBR%20%2F%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EQuery%203%3A%20List%20of%20machines%20which%20has%20IMPORTANT%20SECURITY%20UPDATES%20pending%2C%20which%20are%20more%20than%201%20months%20old%3C%2FSTRONG%3E%3CBR%20%2F%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EQuery%204%3A%20List%20of%20machines%20which%20has%20FEATURE%20UPDATES%20pending%2C%20which%20are%20more%20than%201%20months%20old%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EQuery%205%3A%20List%20of%20machines%20which%20has%20NO%20pending%20updates%2C%20which%20are%20more%20than%201%20months%20old%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%2F%2F%20Microsoft%20Definition%3CBR%20%2F%3E%2F%2F%20----------------------------------------------------------------------------------%3CBR%20%2F%3E%2F%2F%20Critical%20update%20-%20A%20widely%20released%20fix%20for%20a%20specific%20problem%20that%20addresses%20a%20critical%2C%20non-security-related%20bug.%3CBR%20%2F%3E%2F%2F%20Definition%20update%20-%20A%20widely%20released%20and%20frequent%20software%20update%20that%20contains%20additions%20to%20a%20product%E2%80%99s%20definition%20database.%20Definition%20databases%20are%20often%20used%20to%20detect%20objects%20that%20have%20specific%20attributes%2C%20such%20as%20malicious%20code%2C%20phishing%20websites%2C%20or%20junk%20mail.%3CBR%20%2F%3E%2F%2F%20Driver%20-%20Software%20that%20controls%20the%20input%20and%20output%20of%20a%20device.%3CBR%20%2F%3E%2F%2F%20Feature%20pack%20-%20New%20product%20functionality%20that%20is%20first%20distributed%20outside%20the%20context%20of%20a%20product%20release%20and%20that%20is%20typically%20included%20in%20the%20next%20full%20product%20release.%3CBR%20%2F%3E%2F%2F%20Security%20update%20-%20A%20widely%20released%20fix%20for%20a%20product-specific%2C%20security-related%20vulnerability.%20Security%20vulnerabilities%20are%20rated%20by%20their%20severity.%20The%20severity%20rating%20is%20indicated%20in%20the%20Microsoft%20security%20bulletin%20as%20critical%2C%20important%2C%20moderate%2C%20or%20low.%3CBR%20%2F%3E%2F%2F%20Service%20pack%20-%20A%20tested%2C%20cumulative%20set%20of%20all%20hotfixes%2C%20security%20updates%2C%20critical%20updates%2C%20and%20updates.%20Additionally%2C%20service%20packs%20may%20contain%20additional%20fixes%20for%20problems%20that%20are%20found%20internally%20since%20the%20release%20of%20the%20product.%20Service%20packs%20my%20also%20contain%20a%20limited%20number%20of%20customer-requested%20design%20changes%20or%20features.%3CBR%20%2F%3E%2F%2F%20Tool%20-%20A%20utility%20or%20feature%20that%20helps%20complete%20a%20task%20or%20set%20of%20tasks.%3CBR%20%2F%3E%2F%2F%20Update%20-%20A%20widely%20released%20fix%20for%20a%20specific%20problem.%20An%20update%20addresses%20a%20noncritical%2C%20non-security-related%20bug.%3CBR%20%2F%3E%2F%2F%20Update%20rollup%20-%20A%20tested%2C%20cumulative%20set%20of%20hotfixes%2C%20security%20updates%2C%20critical%20updates%2C%20and%20updates%20that%20are%20packaged%20together%20for%20easy%20deployment.%20A%20rollup%20generally%20targets%20a%20specific%20area%2C%20such%20as%20security%2C%20or%20a%20component%20of%20a%20product%2C%20such%20as%20Internet%20Information%20Services%20(IIS).%3CBR%20%2F%3E%2F%2F%20Security-only%20update%20-%20An%20update%20that%20collects%20all%20the%20new%20security%20updates%20for%20a%20given%20month%20and%20for%20a%20given%20product%2C%20addressing%20security-related%20vulnerabilities%3CBR%20%2F%3E%2F%2F%20Monthly%20Rollup%20-%20A%20tested%2C%20cumulative%20set%20of%20updates.%20They%20include%20both%20security%20and%20reliability%20updates%20that%20are%20packaged%20together.%20The%20Monthly%20Rollup%20is%20product%20specific%2C%20addresses%20both%20new%20security%20issues%20and%20nonsecurity%20issues%20in%20a%20single%20update%20and%20will%20proactively%20include%20updates%20that%20were%20released%20in%20the%20past.%20Security%20vulnerabilities%20are%20rated%20by%20their%20severity.%20The%20severity%20rating%20is%20indicated%20in%20the%20Microsoft%20security%20bulletin%20as%20critical%2C%20important%2C%20moderate%2C%20or%20low.%20This%20Monthly%20Rollup%20would%20be%20displayed%20under%20the%20title%20Security%20Monthly%20Quality%20Rollup%20when%20you%20download%20or%20install.%20This%20Monthly%20Rollup%20will%20be%20classified%20as%20an%20%22Important%22%20update%20on%20Windows%20Update%20and%20will%20automatically%20download%20and%20install%20if%20your%20Windows%20Update%20settings%20are%20configured%20to%20automatically%20download%20and%20install%20Important%20updates.%3CBR%20%2F%3E%2F%2F%20Servicing%20Stack%20Updates%20(SSU)%20-%20The%20%22servicing%20stack%22%20is%20the%20code%20that%20installs%20other%20operating%20system%20updates.%20Additionally%2C%20it%20contains%20the%20%22component-based%20servicing%20stack%22%20(CBS)%2C%20which%20is%20a%20key%20underlying%20component%20for%20several%20elements%20of%20Windows%20deployment%2C%20such%20as%20DISM%2C%20SFC%2C%20changing%20Windows%20features%20or%20roles%2C%20and%20repairing%20components.%20The%20CBS%20is%20a%20small%20component%20that%20typically%20does%20not%20have%20updates%20released%20every%20month.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-653116%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELog%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653278%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653278%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F162153%22%20target%3D%22_blank%22%3E%40Morten%20Waltorp%20Knudsen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EHave%20you%20also%20looked%20under%20%22Update%20Management%22%20-%20this%20is%20found%20from%20the%20%3CSTRONG%3EAzure%20Portal%20-%20Automation%20Accounts%20-%20%3CACCT%20name%3D%22%22%3E%20-%20Update%20Management%3C%2FACCT%3E%3C%2FSTRONG%3E.%26nbsp%3B%20You%20can%20pin%20that%20as%20a%20dashboard%20tile.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EClicking%20on%20each%20entry%20takes%20you%20through%20to%20the%20latest%20Log%20Analytics%20syntax%20(so%20might%20have%20a%20better%20query%20to%20start%20with)%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F116292i0C969BA644712C77%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Annotation%202019-05-28%20194554.jpg%22%20title%3D%22Annotation%202019-05-28%20194554.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EClick%20on%20the%20compyter%20to%20go%20to%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F116293iF8B83FB6E62FBC22%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Annotation%202019-05-28%20194629-2.jpg%22%20title%3D%22Annotation%202019-05-28%20194629-2.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%26nbsp%3B%20Azure%20Automation%20solution%20also%20has%20some%20extra%20metadata%2C%20I've%20shared%20the%203%20scenarios%20below%20%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20%3CSTRONG%3ECompliant%26nbsp%3B%3C%2FSTRONG%3E%20(NOTE%3A%26nbsp%3B%20I%20never%20went%20back%20to%20this%2C%20but%20its%20often%20one%20computer%20missing%20-%20so%20there%20must%20be%20another%20value%20to%20check)%3C%2FP%3E%0A%3CPRE%3E%2F%2F%20compliant%0AUpdate%20%0A%7C%20where%20UpdateState%20!%3D%20%22Needed%22%20%20and%20(Classification%20%3D%3D%20%22Security%20Updates%22%20or%20Classification%20%3D%3D%20%22Critical%20Updates%22)%0A%7C%20distinct%20%20Computer%0A%7C%20count%0A%3C%2FPRE%3E%0A%3CP%3E2.%20%3CSTRONG%3Enon-compliant%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CPRE%3E%2F%2F%20non-compliant%0AUpdate%20%0A%7C%20where%20UpdateState%20%3D%3D%20%22Needed%22%20%20and%20(Classification%20%3D%3D%20%22Security%20Updates%22%20or%20Classification%20%3D%3D%20%22Critical%20Updates%22)%0A%7C%20summarize%20count()%20by%20Computer%0A%3C%2FPRE%3E%0A%3CP%3E3.%20%3CSTRONG%3ENot%20assessed%3C%2FSTRONG%3E%20(which%20was%20hard%20to%20convert%20when%20I%20did%20it%20last%20year)%3C%2FP%3E%0A%3CPRE%3EHeartbeat%0A%7C%20where%20TimeGenerated%26gt%3Bago(12h)%20and%20OSType%3D~%22Windows%22%20and%20notempty(Computer)%0A%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%0A%7C%20where%20Solutions%20has%20%22updates%22%0A%7C%20distinct%20SourceComputerId%2C%20Computer%0A%7C%20join%20%20kind%3Dleftouter%20%0A(%0A%20%20%20%20Update%0A%20%20%20%20%7C%20where%20TimeGenerated%26gt%3Bago(14h)%20and%20OSType!%3D%22Linux%22%0A%20%20%20%20%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Classification)%20by%20SourceComputerId%2C%20UpdateID%2C%20Computer%0A%20%20%20%20%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Computer%0A%20%20%20%20%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%20and%20(Optional%3D%3Dfalse%20or%20Classification%20has%20%22Critical%22%20or%20Classification%20has%20%22Security%22)%20and%20Approved!%3Dfalse%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId%2C%20Computer%0A)%0Aon%20SourceComputerId%0A%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(WorstMissingUpdateSeverity%2C-1)%0A%7C%20summarize%20computersBySeverity%3Dcount()%20by%20WorstMissingUpdateSeverity%20%2C%20Computer%0A%7C%20union%20(Heartbeat%0A%7C%20where%20TimeGenerated%26gt%3Bago(12h)%20and%20OSType%3D%3D%22Linux%22%20and%20notempty(Computer)%0A%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%0A%7C%20where%20Solutions%20has%20%22updates%22%0A%7C%20distinct%20SourceComputerId%20%2C%20Computer%0A%7C%20join%20%20kind%3Dleftouter%20%0A(%0A%20%20%20%20Update%0A%20%20%20%20%7C%20where%20TimeGenerated%26gt%3Bago(5h)%20and%20OSType%3D%3D%22Linux%22%0A%20%20%20%20%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Classification)%20by%20SourceComputerId%2C%20Product%2C%20ProductArch%2C%20Computer%0A%20%20%20%20%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Computer%0A%20%20%20%20%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId)%0Aon%20SourceComputerId%0A%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(tolong(WorstMissingUpdateSeverity)%2C%20-1)%0A)%0A%7C%20where%20WorstMissingUpdateSeverity%20%3D%3D-1%0A%7C%20summarize%20NotAssessedTrue%3Dcount(WorstMissingUpdateSeverity)%20by%20Computer%0A%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653649%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653649%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3BWhere%20is%20the%20query%20for%20these%20below%20-%20exactly%20those%20I%20need%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F116328iB78A99429056C690%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%222019-05-28_2229.png%22%20title%3D%222019-05-28_2229.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653899%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653899%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F162153%22%20target%3D%22_blank%22%3E%40Morten%20Waltorp%20Knudsen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECritical%20%26amp%3B%20Security%20I%20think%20is%3A%3C%2FP%3E%0A%3CPRE%3E%2F%2Fcritical%20%26amp%3B%20sec%0AUpdate%20%0A%7C%20where%20UpdateState%20%3D%3D%20%22Needed%22%20%20and%20(Classification%20%3D%3D%20%22Security%20Updates%22%20or%20Classification%20%3D%3D%20%22Critical%20Updates%22)%0A%7C%20distinct%20%20Computer%0A%7C%20count%3C%2FPRE%3E%0A%3CP%3ENon-compliant%20and%20not-assessed%20I%20gave%20you.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOther%3C%2FSTRONG%3E%20I%20need%20to%20take%20a%20look....%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-655431%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-655431%22%20slang%3D%22en-US%22%3EThank%20you%20-%20I%20managed%20to%20solve%20my%20queries%20by%20using%20your%20hints%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-658002%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-658002%22%20slang%3D%22en-US%22%3EIf%20you%20have%20any%20samples%20to%20add%2C%20it%20would%20be%20great%20to%20post%20them%20back%20here%20for%20others%20to%20see%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-658018%22%20slang%3D%22en-US%22%3ERe%3A%20System%20Updates%20queries%2C%20how%20to%20find%20counts%20and%20list%20machines%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-658018%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20are%20the%20queries%20I%20have%20built%20for%20servers%20-%20there%20are%20similar%20ones%20for%20workstations.%20In%20general%2C%20I%20only%20focus%20on%20updates%20which%20are%20more%20than%2031%20days%20old%2C%20so%20I%20don't%20see%20this%20months%20patches.%20We%20use%20it%20to%20find%20any%20incompliant%20machines%2C%20which%20have%20not%20been%20patched%20properly%20during%20the%20monthly%20patch-window.%20I%20also%20ignore%20KBID890830%20(MS%20Removal%20toolkit)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20also%20joining%20data%20from%20a%20Custom%20table%2C%26nbsp%3B%3CSPAN%3ECustomerDeviceConfigCMDB_CL%2C%20where%20I%20merge%20information%20about%20server%20placement%2C%20management-scope%20(Admin-IT%20vs.%20Prod-IT)%2C%20etc.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%7C%20join%20kind%3Dleftouter%20(%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ECustomerDeviceConfigCMDB_CL%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%7C%20extend%20Computer%20%3D%20strcat(DeviceName_s)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20*)%20by%20DeviceName_s%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%7C%20project%20DeviceDescription_s%2C%20CountryPlacement_s%2C%20DeviceManagementScope_s%2CComputer%20%3D%20DeviceName_s%2C%20DeviceName_s%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E)%20on%20DeviceName_s%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%7C%20project%20DeviceName_s%2C%20DeviceDescription_s%2C%20CountryPlacement_s%2C%20DeviceManagementScope_s%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E---------%3C%2FP%3E%3CP%3E%3CSTRONG%3EServers%20-%20Need%20Feature%20Updates%20-%20count%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Feature%20Packs%22)%20or%20(Classification%20%3D%3D%20%22Updates%22)%20or%20(Classification%20%3D%3D%20%22Upgrades%22)%20or%20(Classification%20%3D%3D%20%22Service%20Packs%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E%7C%20count%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Need%20Important%20Security%20updates%20-%20count%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Security%20Updates%22)%20or%20(Classification%20%3D%3D%20%22Update%20Rollups%22)%20or%20(Classification%20%3D%3D%20%22Monthly%20Rollups%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%20and%20(KBID%20!%3D%20%22890830%22)%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E%7C%20count%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Need%20Critical%20Non-Security%20Updates%20-%20count%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Critical%20Updates%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E%7C%20count%3C%2FP%3E%3CP%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Cannot%20collect%20patch%20status%20-%20check%20computer%20-%20count%3C%2FSTRONG%3E%3CBR%20%2F%3EHeartbeat%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D~%22Windows%22%20and%20notempty(Computer)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20where%20Solutions%20has%20%22updates%22%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20join%20kind%3Dleftouter%20(%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType!%3D%22Linux%22%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Classification)%20by%20SourceComputerId%2C%20UpdateID%2C%20Computer%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Computer%3CBR%20%2F%3E%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%20and%20(Optional%3D%3Dfalse%20or%20Classification%20has%20%22Critical%22%20or%20Classification%20has%20%22Security%22)%20and%20Approved!%3Dfalse%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E)%20on%20SourceComputerId%3CBR%20%2F%3E%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(WorstMissingUpdateSeverity%2C-1)%3CBR%20%2F%3E%7C%20summarize%20computersBySeverity%3Dcount()%20by%20WorstMissingUpdateSeverity%20%2C%20Computer%3CBR%20%2F%3E%7C%20union%20(Heartbeat%20%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D%3D%22Linux%22%20and%20notempty(Computer)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20where%20Solutions%20has%20%22updates%22%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%20%2C%20Computer%3CBR%20%2F%3E%7C%20join%20kind%3Dleftouter%20(%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D%3D%22Linux%22%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Classification)%20by%20SourceComputerId%2C%20Product%2C%20ProductArch%2C%20Computer%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Computer%3CBR%20%2F%3E%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId%3CBR%20%2F%3E)%20on%20SourceComputerId%3CBR%20%2F%3E%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(tolong(WorstMissingUpdateSeverity)%2C%20-1)%20)%3CBR%20%2F%3E%7C%20where%20WorstMissingUpdateSeverity%20%3D%3D-1%3CBR%20%2F%3E%7C%20summarize%20NotAssessedTrue%3Dcount(WorstMissingUpdateSeverity)%20by%20Computer%3CBR%20%2F%3E%7Ccount%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Need%20Feature%20Updates%20-%20list%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Feature%20Packs%22)%20or%20(Classification%20%3D%3D%20%22Updates%22)%20or%20(Classification%20%3D%3D%20%22Upgrades%22)%20or%20(Classification%20%3D%3D%20%22Service%20Packs%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Need%20Important%20Security%20updates%20-%20list%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Security%20Updates%22)%20or%20(Classification%20%3D%3D%20%22Update%20Rollups%22)%20or%20(Classification%20%3D%3D%20%22Monthly%20Rollups%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%20and%20(KBID%20!%3D%20%22890830%22)%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Need%20Critical%20Non-Security%20Updates%20-%20list%3C%2FSTRONG%3E%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20now(-30d)%3CBR%20%2F%3E%7C%20where%20OSType!%3D%22Linux%22%20and%20Optional%3D%3Dfalse%3CBR%20%2F%3E%7C%20where%20(UpdateState%20%3D~%20%22Needed%22)%20and%20((Classification%20%3D%3D%20%22Critical%20Updates%22))%20and%20(Approved!%3Dfalse)%20and%20(PublishedDate%20%26lt%3B%20ago(31d))%3CBR%20%2F%3E%7C%20where%20(Product%20contains%20%22server%22)%20and%20(Product%20!contains%20%22drivers%22)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20Computer%2CUpdateID%3CBR%20%2F%3E%7C%20distinct%20Computer%3CBR%20%2F%3E------------------------------------------------------------%3CBR%20%2F%3E%3CSTRONG%3EServers%20-%20Cannot%20collect%20patch%20status%20-%20check%20computer%20-%20list%3C%2FSTRONG%3E%3CBR%20%2F%3EHeartbeat%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D~%22Windows%22%20and%20notempty(Computer)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20where%20Solutions%20has%20%22updates%22%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20join%20kind%3Dleftouter%20(%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType!%3D%22Linux%22%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Classification)%20by%20SourceComputerId%2C%20UpdateID%2C%20Computer%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Approved%2C%20Optional%2C%20Computer%3CBR%20%2F%3E%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%20and%20(Optional%3D%3Dfalse%20or%20Classification%20has%20%22Critical%22%20or%20Classification%20has%20%22Security%22)%20and%20Approved!%3Dfalse%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E)%20on%20SourceComputerId%3CBR%20%2F%3E%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(WorstMissingUpdateSeverity%2C-1)%3CBR%20%2F%3E%7C%20summarize%20computersBySeverity%3Dcount()%20by%20WorstMissingUpdateSeverity%20%2C%20Computer%3CBR%20%2F%3E%7C%20union%20(Heartbeat%20%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D%3D%22Linux%22%20and%20notempty(Computer)%3CBR%20%2F%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20Solutions)%20by%20SourceComputerId%2C%20Computer%3CBR%20%2F%3E%7C%20where%20Solutions%20has%20%22updates%22%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%20%2C%20Computer%3CBR%20%2F%3E%7C%20join%20kind%3Dleftouter%20(%3CBR%20%2F%3EUpdate%3CBR%20%2F%3E%7C%20where%20TimeGenerated%26gt%3Bago(30d)%20and%20OSType%3D%3D%22Linux%22%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20UpdateState%2C%20Classification)%20by%20SourceComputerId%2C%20Product%2C%20ProductArch%2C%20Computer%3CBR%20%2F%3E%7C%20distinct%20SourceComputerId%2C%20Classification%2C%20UpdateState%2C%20Computer%3CBR%20%2F%3E%7C%20summarize%20WorstMissingUpdateSeverity%3Dmax(iff(UpdateState%3D~%22Needed%22%2C%20iff(Classification%20has%20%22Critical%22%2C%204%2C%20iff(Classification%20has%20%22Security%22%2C%202%2C%201))%2C%200))%20by%20SourceComputerId%3CBR%20%2F%3E)%20on%20SourceComputerId%3CBR%20%2F%3E%7C%20extend%20WorstMissingUpdateSeverity%3Dcoalesce(tolong(WorstMissingUpdateSeverity)%2C%20-1)%20)%3CBR%20%2F%3E%7C%20where%20WorstMissingUpdateSeverity%20%3D%3D-1%3CBR%20%2F%3E%7C%20summarize%20NotAssessedTrue%3Dcount(WorstMissingUpdateSeverity)%20by%20Computer%3CBR%20%2F%3E%7C%20extend%20DeviceName_s%20%3D%20toupper(Computer)%3CBR%20%2F%3E%7C%20project%20DeviceName_s%3CBR%20%2F%3E%7C%20join%20kind%3Dleftouter%20(%3CBR%20%2F%3ECustomerDeviceConfigCMDB_CL%3CBR%20%2F%3E%7C%20extend%20Computer%20%3D%20strcat(DeviceName_s)%3CBR%20%2F%3E%7C%20summarize%20hint.strategy%3Dpartitioned%20arg_max(TimeGenerated%2C%20*)%20by%20DeviceName_s%3CBR%20%2F%3E%7C%20project%20DeviceDescription_s%2C%20CountryPlacement_s%2C%20DeviceManagementScope_s%2CComputer%20%3D%20DeviceName_s%2C%20DeviceName_s%3CBR%20%2F%3E)%20on%20DeviceName_s%3CBR%20%2F%3E%7C%20project%20DeviceName_s%2C%20DeviceDescription_s%2C%20CountryPlacement_s%2C%20DeviceManagementScope_s%3CBR%20%2F%3E%7C%20sort%20by%20DeviceName_s%20desc%3CBR%20%2F%3E------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi, I'm trying to make a bunch of queries + new dashboard, that is similar to the built-in queries in the System Update Assessment in Azure LogAnalytics. But I simply don't know, how I can make the right queries. I have tried to describe the needed queries below. Does anyone have something they would share with me - or similar queries, which can inspire me.

 

My customer has made their own definitions/grouping:

// CRITICAL NON-SECURITY UPDATES (monthly): Critical Updates
// IMPORTANT SECURITY UPDATES (monthly): Security Updates, Security-only update, Update Rollups, Monthly Rollups
// IMPORTANT FEATURE UPDATES (planned): Feature Packs, Updates, Servicing Stack Updates, Upgrades, Service Packs

 

// Output: Pie Chart
// Need Critical Updates = CriticalUpdatesCountTotal
// Need Important Security Updates = SecurityUpdatesCountTotal
// Need Important Feature Updates = FeatureUpdatesTotal
// Up to date = NoPendingTotal

 

-------------------------------

Basically I want to find 

  • number of machines, which has CRITICAL NON-SECURITY UPDATES pending, which are more than 1 months old to exclude this months updates
  • number of machines, which have IMPORTANT SECURITY UPDATES pending which are more than 1 months old to exclude this months updates
  • number of machines, which have IMPORTANT FEATURE UPDATES pending which are more than 1 months old to exclude this months updates
  • number of machines, which have NO pending updates which are more than 1 months old to exclude this months updates

Hints ??

 

// ----------------------------------------------------------------------------------
// Query 1: Count of machines (dashboard)
// ----------------------------------------------------------------------------------
Update
// find all Windows updates - excluding Definition Updates and Drivers
| where OSType!="Linux" and Optional==false and Classification != "Definition Updates" and Classification != "Drivers"

 

// Find newest updates entries per computer
| summarize hint.strategy=partitioned arg_max(TimeGenerated, *) by Computer,SourceComputerId,UpdateID

 

// Summarize number of machines, which has CRITICAL NON-SECURITY UPDATES pending, which are more than 1 months old to exclude ths months updates
CriticalUpdatesCountTotal = UpdateState=~"Needed" and Approved!=false and Classification contains "Critical Updates" and PublishedDate < now(-31d)

 

// Summarize number of machines, which have IMPORTANT SECURITY UPDATES pending which are more than 1 months old to exclude ths months updates
SecurityUpdatesCountTotal = UpdateState=~"Needed" and Approved!=false and ( (Classification contains "Security Updates") or (Classification contains "Rollups") ) and PublishedDate < now(-31d)

 

// Summarize number of machines, which have FEATURE UPDATES pending which are more than 1 months old to exclude ths months updates
FeatureUpdatesTotal = UpdateState=~"Needed" and Approved!=false and ( (Classification contains "Feature Packs") or (Classification == "Updates") or (Classification == "Upgrades") or (Classification contains "Service Packs") ) and PublishedDate < now(-31d)

 

// Summarize number of machines, which have NO pending updates which are more than 1 months old to exclude ths months updates
NoPendingTotal = UpdateState=~"Needed" and Approved!=false and ( (Classification contains "Feature Packs") or (Classification == "Updates") or (Classification == "Upgrades") or (Classification contains "Service Packs") ) and PublishedDate < now(-31d)


// Output: Pie Chart
// Need Critical Updates = CriticalUpdatesCountTotal
// Need Important Security Updates = SecurityUpdatesCountTotal
// Need Important Feature Updates = FeatureUpdatesTotal
// Up to date = NoPendingTotal

 

// ----------------------------------------------------------------------------------

Query 2: List of machines which has CRITICAL NON-SECURITY UPDATES pending, which are more than 1 months old
// ----------------------------------------------------------------------------------
Query 3: List of machines which has IMPORTANT SECURITY UPDATES pending, which are more than 1 months old
// ----------------------------------------------------------------------------------
Query 4: List of machines which has FEATURE UPDATES pending, which are more than 1 months old

// ----------------------------------------------------------------------------------
Query 5: List of machines which has NO pending updates, which are more than 1 months old

 

// ----------------------------------------------------------------------------------
// Microsoft Definition
// ----------------------------------------------------------------------------------
// Critical update - A widely released fix for a specific problem that addresses a critical, non-security-related bug.
// Definition update - A widely released and frequent software update that contains additions to a product’s definition database. Definition databases are often used to detect objects that have specific attributes, such as malicious code, phishing websites, or junk mail.
// Driver - Software that controls the input and output of a device.
// Feature pack - New product functionality that is first distributed outside the context of a product release and that is typically included in the next full product release.
// Security update - A widely released fix for a product-specific, security-related vulnerability. Security vulnerabilities are rated by their severity. The severity rating is indicated in the Microsoft security bulletin as critical, important, moderate, or low.
// Service pack - A tested, cumulative set of all hotfixes, security updates, critical updates, and updates. Additionally, service packs may contain additional fixes for problems that are found internally since the release of the product. Service packs my also contain a limited number of customer-requested design changes or features.
// Tool - A utility or feature that helps complete a task or set of tasks.
// Update - A widely released fix for a specific problem. An update addresses a noncritical, non-security-related bug.
// Update rollup - A tested, cumulative set of hotfixes, security updates, critical updates, and updates that are packaged together for easy deployment. A rollup generally targets a specific area, such as security, or a component of a product, such as Internet Information Services (IIS).
// Security-only update - An update that collects all the new security updates for a given month and for a given product, addressing security-related vulnerabilities
// Monthly Rollup - A tested, cumulative set of updates. They include both security and reliability updates that are packaged together. The Monthly Rollup is product specific, addresses both new security issues and nonsecurity issues in a single update and will proactively include updates that were released in the past. Security vulnerabilities are rated by their severity. The severity rating is indicated in the Microsoft security bulletin as critical, important, moderate, or low. This Monthly Rollup would be displayed under the title Security Monthly Quality Rollup when you download or install. This Monthly Rollup will be classified as an "Important" update on Windows Update and will automatically download and install if your Windows Update settings are configured to automatically download and install Important updates.
// Servicing Stack Updates (SSU) - The "servicing stack" is the code that installs other operating system updates. Additionally, it contains the "component-based servicing stack" (CBS), which is a key underlying component for several elements of Windows deployment, such as DISM, SFC, changing Windows features or roles, and repairing components. The CBS is a small component that typically does not have updates released every month.

6 Replies
Highlighted
Solution

Hello @Morten Waltorp Knudsen 


Have you also looked under "Update Management" - this is found from the Azure Portal - Automation Accounts - <acct name> - Update Management.  You can pin that as a dashboard tile.

 

Clicking on each entry takes you through to the latest Log Analytics syntax (so might have a better query to start with) 

 

Annotation 2019-05-28 194554.jpg

Click on the compyter to go to 

Annotation 2019-05-28 194629-2.jpg

 

 

The  Azure Automation solution also has some extra metadata, I've shared the 3 scenarios below :

 

1. Compliant  (NOTE:  I never went back to this, but its often one computer missing - so there must be another value to check)

// compliant
Update 
| where UpdateState != "Needed"  and (Classification == "Security Updates" or Classification == "Critical Updates")
| distinct  Computer
| count

2. non-compliant 

// non-compliant
Update 
| where UpdateState == "Needed"  and (Classification == "Security Updates" or Classification == "Critical Updates")
| summarize count() by Computer

3. Not assessed (which was hard to convert when I did it last year)

Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId, Computer
| join  kind=leftouter 
(
    Update
    | where TimeGenerated>ago(14h) and OSType!="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Approved, Optional, Classification) by SourceComputerId, UpdateID, Computer
    | distinct SourceComputerId, Classification, UpdateState, Approved, Optional, Computer
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed" and (Optional==false or Classification has "Critical" or Classification has "Security") and Approved!=false, iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId, Computer
)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity,-1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity , Computer
| union (Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId , Computer
| join  kind=leftouter 
(
    Update
    | where TimeGenerated>ago(5h) and OSType=="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by SourceComputerId, Product, ProductArch, Computer
    | distinct SourceComputerId, Classification, UpdateState, Computer
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed", iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(tolong(WorstMissingUpdateSeverity), -1)
)
| where WorstMissingUpdateSeverity ==-1
| summarize NotAssessedTrue=count(WorstMissingUpdateSeverity) by Computer

 

 

 

 

Highlighted

@Clive Watson Where is the query for these below - exactly those I need :)

2019-05-28_2229.png

 

Highlighted

@Morten Waltorp Knudsen 

 

Critical & Security I think is:

//critical & sec
Update 
| where UpdateState == "Needed"  and (Classification == "Security Updates" or Classification == "Critical Updates")
| distinct  Computer
| count

Non-compliant and not-assessed I gave you.

 

Other I need to take a look....

Highlighted
Thank you - I managed to solve my queries by using your hints
Highlighted
If you have any samples to add, it would be great to post them back here for others to see?
Highlighted

@Clive Watson 

Here are the queries I have built for servers - there are similar ones for workstations. In general, I only focus on updates which are more than 31 days old, so I don't see this months patches. We use it to find any incompliant machines, which have not been patched properly during the monthly patch-window. I also ignore KBID890830 (MS Removal toolkit)

 

I'm also joining data from a Custom table, CustomerDeviceConfigCMDB_CL, where I merge information about server placement, management-scope (Admin-IT vs. Prod-IT), etc.

 

| join kind=leftouter (
CustomerDeviceConfigCMDB_CL
| extend Computer = strcat(DeviceName_s)
| summarize hint.strategy=partitioned arg_max(TimeGenerated, *) by DeviceName_s
| project DeviceDescription_s, CountryPlacement_s, DeviceManagementScope_s,Computer = DeviceName_s, DeviceName_s
) on DeviceName_s
| project DeviceName_s, DeviceDescription_s, CountryPlacement_s, DeviceManagementScope_s

---------

Servers - Need Feature Updates - count
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Feature Packs") or (Classification == "Updates") or (Classification == "Upgrades") or (Classification == "Service Packs")) and (Approved!=false) and (PublishedDate < ago(31d))
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
| count
------------------------------------------------------------
Servers - Need Important Security updates - count
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Security Updates") or (Classification == "Update Rollups") or (Classification == "Monthly Rollups")) and (Approved!=false) and (PublishedDate < ago(31d)) and (KBID != "890830")
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
| count
------------------------------------------------------------
Servers - Need Critical Non-Security Updates - count
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Critical Updates")) and (Approved!=false) and (PublishedDate < ago(31d))
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
| count

------------------------------------------------------------
Servers - Cannot collect patch status - check computer - count
Heartbeat
| where TimeGenerated>ago(30d) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId, Computer
| join kind=leftouter (
Update
| where TimeGenerated>ago(30d) and OSType!="Linux"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Approved, Optional, Classification) by SourceComputerId, UpdateID, Computer
| distinct SourceComputerId, Classification, UpdateState, Approved, Optional, Computer
| summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed" and (Optional==false or Classification has "Critical" or Classification has "Security") and Approved!=false, iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId, Computer
) on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity,-1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity , Computer
| union (Heartbeat | where TimeGenerated>ago(30d) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId , Computer
| join kind=leftouter (
Update
| where TimeGenerated>ago(30d) and OSType=="Linux"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by SourceComputerId, Product, ProductArch, Computer
| distinct SourceComputerId, Classification, UpdateState, Computer
| summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed", iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
) on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(tolong(WorstMissingUpdateSeverity), -1) )
| where WorstMissingUpdateSeverity ==-1
| summarize NotAssessedTrue=count(WorstMissingUpdateSeverity) by Computer
|count
------------------------------------------------------------
Servers - Need Feature Updates - list
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Feature Packs") or (Classification == "Updates") or (Classification == "Upgrades") or (Classification == "Service Packs")) and (Approved!=false) and (PublishedDate < ago(31d))
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
------------------------------------------------------------
Servers - Need Important Security updates - list
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Security Updates") or (Classification == "Update Rollups") or (Classification == "Monthly Rollups")) and (Approved!=false) and (PublishedDate < ago(31d)) and (KBID != "890830")
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
------------------------------------------------------------
Servers - Need Critical Non-Security Updates - list
Update
| where TimeGenerated > now(-30d)
| where OSType!="Linux" and Optional==false
| where (UpdateState =~ "Needed") and ((Classification == "Critical Updates")) and (Approved!=false) and (PublishedDate < ago(31d))
| where (Product contains "server") and (Product !contains "drivers")
| summarize arg_max(TimeGenerated, *) by Computer,UpdateID
| distinct Computer
------------------------------------------------------------
Servers - Cannot collect patch status - check computer - list
Heartbeat
| where TimeGenerated>ago(30d) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId, Computer
| join kind=leftouter (
Update
| where TimeGenerated>ago(30d) and OSType!="Linux"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Approved, Optional, Classification) by SourceComputerId, UpdateID, Computer
| distinct SourceComputerId, Classification, UpdateState, Approved, Optional, Computer
| summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed" and (Optional==false or Classification has "Critical" or Classification has "Security") and Approved!=false, iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId, Computer
) on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity,-1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity , Computer
| union (Heartbeat | where TimeGenerated>ago(30d) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId, Computer
| where Solutions has "updates"
| distinct SourceComputerId , Computer
| join kind=leftouter (
Update
| where TimeGenerated>ago(30d) and OSType=="Linux"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by SourceComputerId, Product, ProductArch, Computer
| distinct SourceComputerId, Classification, UpdateState, Computer
| summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed", iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
) on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(tolong(WorstMissingUpdateSeverity), -1) )
| where WorstMissingUpdateSeverity ==-1
| summarize NotAssessedTrue=count(WorstMissingUpdateSeverity) by Computer
| extend DeviceName_s = toupper(Computer)
| project DeviceName_s
| join kind=leftouter (
CustomerDeviceConfigCMDB_CL
| extend Computer = strcat(DeviceName_s)
| summarize hint.strategy=partitioned arg_max(TimeGenerated, *) by DeviceName_s
| project DeviceDescription_s, CountryPlacement_s, DeviceManagementScope_s,Computer = DeviceName_s, DeviceName_s
) on DeviceName_s
| project DeviceName_s, DeviceDescription_s, CountryPlacement_s, DeviceManagementScope_s
| sort by DeviceName_s desc
------------------------------------------------------------