WSUS Updates Report – Consolidate number of ‘needed count’

Hi All,

I was tasked exporting the WSUS “Computer Tabular Report’ to an excel/csv file (automated). I am able to do this from the WSUS console, but it would be a manual process. I figured I would be able to leverage powershell to get this automated..

The powershell script I am using essentially connects to the WSUS API, lists all of the computers in the ‘All Computers’ group, and outputs the ‘needed’ count to a CSV format.

The script works perfect, but I am there a way to ‘consolidate’ or ‘lump’ the duplicate ‘needed count’ numbers?

For example…we have 400 workstations that only ‘need’ 1 update. Is there a way to somehow show that 400 workstations ‘need’ 1 update..20 workstations ‘need’ 23 updates, 10 workstations need 25 updates..etc?

This is the script in use…

[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”) $wsus =[Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer(“WSUS.domain.local”,$False, 8530) $wsus $wsus.GetComputerTargetGroup([guid]” a0a08746-4dbe-4a37-9adf-9e7652c0b421”) $computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope $updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope $classifications=$wsus.GetUpdateClassifications() | ?{ $_.Title -eq "Critical Updates" ` -OR $_.Title -eq "Security Updates" ` } $updatescope.Classifications.Clear() $updatescope.Classifications.AddRange($classifications) $wsus.GetSummariesPerComputerTarget($updatescope,$computerscope) | Select-Object @{L=’ComputerTarget’;E= {($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName}}, @{L=’NeededCount’;E={($_.DownloadedCount + $_.NotInstalledCount)}},DownloadedCount,NotApplicableCount,NotInstalledCount,InstalledCount,FailedCount | Export-Csv -NoTypeInformation 'WsusReport.csv' " 

submitted by /u/StylinNProfilin
[link] [comments]

Leave a Reply