WSUS Product Team Blog

WSUS Product Team thoughts, information, tips and tricks and beyond :-)

Finding machines not compliant with a specific security bulletin

Finding machines not compliant with a specific security bulletin

  • Comments 18
  • Likes

I read Marc’s post about Compliance Reporting and it was similar to a problem I deal with in my job.  Part of my job is to run Update Management on one of the domains consisting of around 12,000 managed computers at Microsoft using WSUS.  We do this in order to validate WSUS (and similar products) in an environment with real users.  Another group at Microsoft audits my compliance, and often request a list of non-compliant machines for specific security bulletins.  I have adapted Marc’s SQL script to do just that.

 

I ran into one issue, Marc’s SQL script will blocks clients from scanning while it runs.  Since the script can take a long time to execute on larger data sets, I decided to allow SQL to read dirty data and unblock my clients (SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED.).

 

I hope you find this useful.

 

Travis Plunk

Software Design Engineer in Test II, WSUS

 

-- Find computers within a target group that need a security bulletin

 

USE

SUSDB

go

 

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

GO

 

DECLARE

@TargetGroup nvarchar(30)

DECLARE

@Bulletin nvarchar(9)

 

SELECT

 

@TargetGroup = 'All Computers'

SELECT

@Bulletin = 'MS08-030'

 

 

-- Find the computers not compliant for each security bulletin in the given @TargetGroup

-- where the approved occured between @Days and @DaysEnd days ago

 

SELECT              ct.Name,@Bulletin as Bulletin,ct.LastReportedStatusTime

FROM         PUBLIC_VIEWS.vComputerGroupMembership as cgm INNER JOIN

                      PUBLIC_VIEWS.vComputerTarget as ct ON

                      cgm.ComputerTargetId = ct.ComputerTargetId INNER JOIN

                      PUBLIC_VIEWS.vComputerTargetGroup as ctg ON

                      cgm.ComputerTargetGroupId = ctg.ComputerTargetGroupId

                     

WHERE     (ctg.Name = @TargetGroup)

-- And only select those for which an update is approved for install, the

-- computer status for that update is either 2 (not installed), 3 (downloaded),

-- 5 (failed), or 6 (installed pending reboot), and

-- the update bulletin is the one provided.

                              AND EXISTS

                          (SELECT     1

                            FROM          PUBLIC_VIEWS.vUpdateEffectiveApprovalPerComputer as ueapc INNER JOIN

                                                   PUBLIC_VIEWS.vUpdateApproval as ua ON

                                                   ua.UpdateApprovalId = ueapc.UpdateApprovalId INNER JOIN

                                                   PUBLIC_VIEWS.vUpdateInstallationInfoBasic uiib ON

                                                   uiib.ComputerTargetId = ct.ComputerTargetId AND

                                                   ua.UpdateId = uiib.UpdateId

                                                   inner join PUBLIC_VIEWS.vUpdate as u on ua.updateid=u.updateId 

                            WHERE      (ueapc.ComputerTargetId = ct.ComputerTargetId) AND

                                                   (ua.Action = 'Install') AND (uiib.State IN (2, 3, 5, 6)) AND u.securityBulletin is not null and u.securityBulletin=@Bulletin )

 

Travis Plunk

OMPS - Customer Readiness Test

Comments
  • Microsoft's Travis Plunk posted a modified version of Marc Shepard's WSUS SQL script for producing

  • Forefront Client Security is a special case since it is not detected as needed until a policy change is implemented on the computer. There is also no MSRC bulletin associated with the installer.

    To query for computers where the FCS client is not installed, use AND NOT EXISTS between the select statements and set uiib.State = 4 (update installed).

    Also change securityBulletin to KnowledgebaseArticle and @Bulletin to @KBArticle and set it equal to 952265 (as of now).

  • Hi,

    I was wondering if you might have any information on how to cretae reports by utilizing the SQL report engine. Is there any rdl (report definition files) for WSUS db?

    Thanks

    Björn

  • Categories: Business Process Management , Desktop/Mobile , Dynamics , General , Microsoft Press Pass

  • Do you get the occasional OutOfMemoryException error when running reports in WSUS?  Are you looking

  • Internet explorer has finnaly the perfect [url=http://www.lookanddiscover.com]homepage[/url] ! see  the [url=http://www.lookanddiscover.com]homepage[/url] for yourself

  • Internet explorer has finnaly the perfect [url=http://www.lookanddiscover.com]homepage[/url] ! see  the [url=http://www.lookanddiscover.com]homepage[/url] for yourself

  • Hello!

    My name is Alex.

    Who Else Wants a Higher Paying Job?

    contact me: olgas32@gmail.com

  • thanks

    very nice good site

    beatiful

  • Dumb question... where would you run this script in?

  • http://www.battery-export.com/hp/hp-pavilion-dv6300-series.html  HP Pavilion dv6300 Series  

    http://www.battery-export.com/hp/hp-pavilion-dv6600-series.html  HP Pavilion dv6600 Series  

    http://www.battery-export.com/hp/hp-pavilion-dv8000-series.html  HP Pavilion dv8000 Series

  • Great post, explained really well and I could really understand. Thank you.

  • thansk <a href="http://www.trstar.net" title="chat sohbet, sohbet odalari">sohbet chat</a> sites mcxno spam :S

  • Hello!

    My name is Alex.

    Who Else Wants a Higher Paying Job?

    contact me: olgas32@gmail.com

  • Great post, explained really well and I could really understand. Thank you

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment