Quantcast
Channel: WSUS forum
Viewing all articles
Browse latest Browse all 12874

WSUS computer reports done with grouping/containers

$
0
0

This is not an issue/question, I'm just posting something which may help others in doing WSUS reporting tasks.  I hope you will find this information useful and feel free to enhance it any way you can by sharing it with others.

WSUS has always lacked a few things with its built-in reporting capabilities which by the time you are patching end-points above double digits within a not-so-flat design, it can become a major time waster.  One thing I've always wanted in the Computer reports in WSUS was to see a breakdown of system compliancy of all servers/desktops by having an additional column which would reflect the computer groups and containers that I've used to organize my WSUS hierarchy.

I'm specifically referring to the Computer Tabular Status report.  This would eliminate the need to run a sepae report for each computer group and then grouping them all together manually afterwards.  Using this code, I can now view all the computer groups and the systems contained within them in a single view.

To do this I've scoured around the net and by spending some time in SQL, I've written a basic SQL query which you can issue against your WSUS database either through SQL Management Studio or just by wrapping the code into a script and using SQLCMD.exe

In my specific case, I'm using the basic Windows Internal DB but if you just re-work some of the table paths it can be used against a full SQL DB install as well.  This was done under WSUS 3.0, I'm not sure if Win 2012 WSUS has enhanced reporting or not but I know WSUS 3.0 is still very common.

SELECT DISTINCT tbTargetGroup.Name, tbComputerTarget.FullDomainName, tbComputerTarget.IPAddress, tbComputerSummaryForMicrosoftUpdates.Installed, tbComputerSummaryForMicrosoftUpdates.NotInstalled, tbComputerSummaryForMicrosoftUpdates.InstalledPendingReboot, tbComputerSummaryForMicrosoftUpdates.Downloaded, tbComputerSummaryForMicrosoftUpdates.Failed, tbComputerSummaryForMicrosoftUpdates.Unknown
FROM SUSDB.dbo.tbComputerTarget tbComputerTarget, SUSDB.dbo.tbTargetGroup tbTargetGroup, SUSDB.dbo.tbTargetInTargetGroup tbTargetInTargetGroup, SUSDB.dbo.tbComputerSummaryForMicrosoftUpdates
WHERE tbTargetInTargetGroup.TargetGroupID = tbTargetGroup.TargetGroupID AND tbTargetInTargetGroup.TargetID = tbComputerTarget.TargetID AND tbComputerTarget.TargetID = tbComputerSummaryForMicrosoftUpdates.TargetID AND tbTargetGroup.Name != 'Unassigned Computers'
ORDER BY tbTargetGroup.Name ASC

The above block of code will basically show several essential columns of information about the systems being managed by WSUS, such as name, IP, etc. but most importantly will group them by using the first column on the left as how you've grouped them into computer containers in your WSUS console.  You can of course choose to remove whatever columns you don't need or include other columns from different tables if you want, but the main thing is in the WHERE line where the reference between group names and group GUIDs are established and by creating a relationship between computers and their respective groups.

You can copy the outpt into Excel or do wherever else you want to manipulate it further.  I've for example used some additional SQL queries and Excel formulas to show the percentage compliancy which is also not presented in the build-it reports but is visible in the WSUS console itself.

Enjoy,

Armin



Viewing all articles
Browse latest Browse all 12874

Trending Articles