 <#
 $SUG = "Server 2008 Required Updates",
        "Server 2008 R2 Requred Patches",
        "Server 2016 Required Patches",
        "Server 2019 Required Patches",
        "Server 2012 R2 Required Patches"

#$P | select LocalizedDisplayName,Updates

#$P = Get-CMSoftwareUpdateGroup | ? { $_.LocalizedDisplayName -eq "Server 2008 R2 Requred Patches" }
$P | select LocalizedDisplayName, @{n="Updates";e={$_.Updates | Out-String}} | ft -Wrap

#>





$info = @()

ForEach ($item in $SUG)
{
  # Write-host "Processing Software Update Group" $item

   forEach ($item1 in (Get-CMSoftwareUpdate -Fast -UpdateGroupName $item))
   {
    $object = New-Object -TypeName PSObject
    $object | Add-Member -MemberType NoteProperty -Name UpdateGroup -Value $item
    $object | Add-Member -MemberType NoteProperty -Name ArticleID -Value $item1.ArticleID
    $object | Add-Member -MemberType NoteProperty -Name BulletinID -Value $item1.BulletinID
    $object | Add-Member -MemberType NoteProperty -Name Title -Value $item1.LocalizedDisplayName
    $info += $object
    $object
    }
}


#$Title = "Total assigned software updates in " + $item.LocalizedDisplayName + " = " + $info.count
#$info | Out-GridView -Title "$Title"




#Get-CMSoftwareUpdate -Fast -UpdateGroupName "Server 2008 Required Updates"

