jnelson993
Posts: 900
Score: 127 Joined: 2/18/2005 From: Minneapolis, MN Status: offline
|
Well, if you're looking for a summary report to just pull the details by the domain, just pull out the other things of the query and just have your domain and the % Compliant something like this: --SQL QUERY FOR SUMMARY REPORT - Patch Compliance By Domain SELECT cs.domain0 AS [Domain], 100 * SUM(CASE WHEN pse.LastStateName = 'Install Verified' THEN 1 ELSE 0 END) / COUNT(*) AS '% Compliant' FROM dbo.v_GS_PatchStatusEx AS pse INNER JOIN dbo.v_GS_COMPUTER_SYSTEM AS cs ON pse.ResourceID = cs.ResourceID WHERE pse.ID like 'MS%' GROUP BY cs.Domain0 ORDER BY cs.domain0 That report would link to the next report so when you clicked on a domain, it would pass the domain column from report 1 to the @Domain prompt in this report and you'd see the results for that domain...something like this: -- SQL QUERY FOR INTERMEDIATE REPORT - Patch Status for a Specific Domain (by Update) SELECT cs.domain0 AS [Domain], pse.ID, pse.Title, 100 * SUM(CASE WHEN pse.LastStateName = 'Install Verified' THEN 1 ELSE 0 END) / COUNT(*) AS '% Compliant', SUM(CASE WHEN pse.LastStateName = 'Install Verified' THEN 1 ELSE 0 END) AS 'Install Verified', SUM(CASE WHEN pse.LastStateName = 'No Status' THEN 1 ELSE 0 END) AS 'No Status', SUM(CASE WHEN pse.LastStateName = 'Waiting' THEN 1 ELSE 0 END) AS 'Waiting', SUM(CASE WHEN pse.LastStateName = 'Retrying' THEN 1 ELSE 0 END) AS 'Retrying', SUM(CASE WHEN pse.LastStateName = 'Failed' THEN 1 ELSE 0 END) AS 'Failed', SUM(CASE WHEN pse.LastStateName = 'Uninstalled' THEN 1 ELSE 0 END) AS 'Uninstalled', SUM(CASE WHEN pse.LastStateName = 'Preliminary Success' THEN 1 ELSE 0 END) AS 'Preliminary Success', SUM(CASE WHEN pse.LastStateName = 'Reboot Pending' THEN 1 ELSE 0 END) AS 'Reboot Pending', pse.LocaleID, pse.UpdateID FROM dbo.v_GS_PatchStatusEx AS pse INNER JOIN dbo.v_GS_COMPUTER_SYSTEM AS cs ON pse.ResourceID = cs.ResourceID WHERE pse.ID like 'MS%' AND cs.domain0 = @Domain GROUP BY cs.domain0, pse.ID, pse.Title, pse.LocaleID, pse.UpdateID ORDER BY pse.UpdateID DESC and if you wanted to then see the details of a particular patch, you'd pass the domain, ID and UpdateID to the @Domain, @ID and @UpdateID prompt in this report to get the details...something like this: -- SQL QUERY FOR DETAIL REPORT SELECT cs.domain0 AS [Domain], cs.name0 AS [Computer Name], cs.UserName0 AS [User Name], pse.ID, pse.Title, 100 * SUM(CASE WHEN pse.LastStateName = 'Install Verified' THEN 1 ELSE 0 END) / COUNT(*) AS '% Compliant', SUM(CASE WHEN pse.LastStateName = 'Install Verified' THEN 1 ELSE 0 END) AS 'Install Verified', SUM(CASE WHEN pse.LastStateName = 'No Status' THEN 1 ELSE 0 END) AS 'No Status', SUM(CASE WHEN pse.LastStateName = 'Waiting' THEN 1 ELSE 0 END) AS 'Waiting', SUM(CASE WHEN pse.LastStateName = 'Retrying' THEN 1 ELSE 0 END) AS 'Retrying', SUM(CASE WHEN pse.LastStateName = 'Failed' THEN 1 ELSE 0 END) AS 'Failed', SUM(CASE WHEN pse.LastStateName = 'Uninstalled' THEN 1 ELSE 0 END) AS 'Uninstalled', SUM(CASE WHEN pse.LastStateName = 'Preliminary Success' THEN 1 ELSE 0 END) AS 'Preliminary Success', SUM(CASE WHEN pse.LastStateName = 'Reboot Pending' THEN 1 ELSE 0 END) AS 'Reboot Pending', cs.Manufacturer0 AS [Make], cs.Model0 AS [Model], cs.TotalPhysicalMemory0 AS [Memory] pse.LocaleID, pse.UpdateID FROM dbo.v_GS_PatchStatusEx AS pse INNER JOIN dbo.v_GS_COMPUTER_SYSTEM AS cs ON pse.ResourceID = cs.ResourceID WHERE cs.domain0 = @Domain AND pse.ID = @ID AND pse.UpdateID = @UpdateID GROUP BY cs.domain0, cs.name0 AS [Computer Name], cs.UserName0 AS [User Name], pse.ID, pse.Title, cs.Manufacturer0 AS [Make], cs.Model0 AS [Model], cs.TotalPhysicalMemory0 AS [Memory] pse.LocaleID, pse.UpdateID ORDER BY cs.domain0, cs.name0, pse.updateID DESC
_____________________________
Number2 (John Nelson) MyITForum - Blog MyITForum - Forum Posts
|