wsus query needed - get WSUS-Computers, belonging WSUS-Group and Not Installed Count

Hi,

i try to find a way by using basic WSUS powershell cmds in combination with piping in Server 2012 R2 to get all registered computers in WSUS plus belonging WSUS-Group and Update "Not Installed Count" as output.

Is that possible?

I tried multiple times and enden up in using posh - is there no way based on standard powershell commandlets.

Thank you

Peter

February 24th, 2015 3:12am

Hi Peter,

the native WSUS cmdlets are pretty limited, it doesn't capture update info per group, just summary across all groups. I think PoshWSUS is your best bet (unless you want to write a lot of custom cmdlets against either WSUS or SQL, but that defeats the purpose :) )

 

Free Windows Admin Tool Kit Click here and download it now
February 24th, 2015 12:59pm

Hi Michael,

it seems that you are right :(. I tried out a few things with powershell (source http://blogs.technet.com/b/heyscriptingguy/archive/2012/01/19/use-powershell-to-find-missing-updates-on-wsus-client-computers.aspx) - big problem is that i actually cant get belonging WSUS Group to Server object. I only are able to get all WSUS Groups but cant find the right sytax to get only belonging ones.

Any ideas?

Thanks

Peter

#Load assemblies

[void][system.reflection.assembly]::LoadWithPartialName('Microsoft.UpdateServices.Administration')

#Create Scope objects

$computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope

$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope

#Gather only servers

$ServersId = @($wsus.GetComputerTargets($computerscope) | Where {

   $_.OSDescription -like "*Server*"

} | Select -expand Id)

#Get Update Summary

$wsus.GetSummariesPerComputerTarget($updatescope,$computerscope) | Where {

   #Filter out non servers

   $ServersId -Contains $_.ComputerTargetID

} | ForEach {

   New-Object PSObject -Property @{

       ComputerTarget = ($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName

       ComputerTargetGroupIDs = ($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).ComputerTargetGroupIds
             
       ComputerTargetGroupNames = ($wsus.GetComputerTargetGroups())       
    
       NeededCount = ($_.DownloadedCount + $_.NotInstalledCount)

       #DownloadedCount = $_.DownloadedCount

       NotInstalledCount = $_.NotInstalledCount

       #InstalledCount = $_.InstalledCount
   }
   
}



February 24th, 2015 1:44pm

big problem is that i actually cant get belonging WSUS Group to Server object. I only are able to get all WSUS Groups but cant find the right sytax to get only belonging ones.

Hi Peter, is that you just want to filter based on a particular WSUS group? if so, try replacing 

$_.OSDescription -like "*Server*"

with

($_.OSDescription -like "*Server*" ) -and  ($_.RequestedTargetGroupName -like "Personal VMs" )

("Personal VMs" is the name of one of my WSUS groups)

Free Windows Admin Tool Kit Click here and download it now
February 27th, 2015 1:00pm

Hi Peter,

We've not heard from you yet. I assume the information provided by Michael has helped. I am marking this reply as answered now.

In case the information did not help, please feel free to unmark the answer and come back to us with your comments.

Best Regards.

March 9th, 2015 2:07am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics