Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateServicesServer, UpdateServicesApprovalRule: Fixing Products processing, verbose output #64

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fixed `UpdateServicesServer` and `UpdateServicesApprovalRule`
- Process multiple product categories with the same name correctly (e.g. "Windows Admin Center")
- Verbose output of Products only displayed one product
- Fixed verbose output of Languages in `UpdateServiceServer`
- Fixed verbose output of WSUS server in `UpdateServicesApprovalRule`

### Changed

- Updated inital offline package sync WSUS.cab.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Get-TargetResource

if ($null -ne $WsusServer)
{
Write-Verbose -Message ('Identified WSUS server information: {0}' -f $WsusServer)
Write-Verbose -Message ('Identified WSUS server information: {0}' -f $WsusServer.Name)

$ApprovalRule = $WsusServer.GetInstallApprovalRules() | Where-Object -FilterScript { $_.Name -eq $Name }

Expand Down Expand Up @@ -215,11 +215,14 @@ function Set-TargetResource
$ApprovalRule.Save()

$ProductCollection = New-Object -TypeName Microsoft.UpdateServices.Administration.UpdateCategoryCollection
$AllWsusProducts = $WsusServer.GetUpdateCategories()
foreach ($Product in $Products)
{
if ($WsusProduct = Get-WsusProduct | Where-Object -FilterScript { $_.Product.Title -eq $Product })
if ($WsusProduct = $AllWsusProducts | Where-Object -FilterScript { $_.Title -eq $Product })
{
$ProductCollection.Add($WsusServer.GetUpdateCategory($WsusProduct.Product.Id))
$WsusProduct | Foreach-Object {
$ProductCollection.Add($_)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Get-TargetResource
}
else
{
$Languages = $WsusConfiguration.GetEnabledUpdateLanguages()
$Languages = ($WsusConfiguration.GetEnabledUpdateLanguages()) -join ','
}

Write-Verbose -Message ($script:localizedData.WsusLanguages -f $Languages)
Expand All @@ -141,9 +141,9 @@ function Get-TargetResource

Write-Verbose -Message ($script:localizedData.WsusClassifications -f $Classifications)
Write-Verbose -Message $script:localizedData.GettingWsusProducts
if ($Products = @($WsusSubscription.GetUpdateCategories().Title))
if ($Products = (@($WsusSubscription.GetUpdateCategories().Title) | Sort-Object -Unique))
{
if ($null -eq (Compare-Object -ReferenceObject ($Products | Sort-Object -Unique) -DifferenceObject `
if ($null -eq (Compare-Object -ReferenceObject $Products -DifferenceObject `
(($WsusServer.GetUpdateCategories().Title) | Sort-Object -Unique) -SyncWindow 0))
{
$Products = @('*')
Expand Down