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

(GH-47) wsus-config-update-products: Fixes Duplicate Product Name Selection #48

Merged
Merged
Changes from 3 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
14 changes: 11 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,11 @@
Exit 3
}
else {
# product title is valid. add it to the new collection
[void]\$NewProducts.add( (\$allPossibleProducts | Where-Object {\$_.Title -eq \$product -and \$_.type -eq \$Type} | Select-Object -First 1) )
\$matchingproduct = \$allPossibleProducts | Where-Object {\$_.Title -eq \$product -and \$_.type -eq \$Type}
ForEach (\$product in \$matchingproduct) {
# product title is valid. add it to the new collection
[void]\$NewProducts.add( \$product )
}
}
}
}
Expand All @@ -403,7 +406,7 @@
\$wsusServerSubscription.GetUpdateCategories() | ForEach-Object {[void]\$currentProducts.add(\$_)}

# get products configured that match the supplied type
\$referenceObject = \$currentProducts | where-object {\$_.type -eq \$Type} | Select-Object -ExpandProperty Title -Unique
\$referenceObject = \$currentProducts | where-object {\$_.type -eq \$Type} | Select-Object -ExpandProperty Title

# if none, blank array for object compare
if (\$null -eq \$referenceObject) { \$referenceObject = @('') }
Expand Down Expand Up @@ -508,7 +511,12 @@
else {
\$desired_products = \$commaSeparatedProducts.Split(\";\")
\$desired_productfamilies = \$commaSeparatedProductFamilies.Split(\";\")
#Find all matching products name in the case of multiples
\$desired_products = ((Get-WsusServer).GetUpdateCategories() | Where-Object {\$_.type -eq \"product\" -and \$desired_products -eq \$_.Title }).Title
\$desired_productfamilies = ((Get-WsusServer).GetUpdateCategories() | Where-Object {\$_.type -eq \"productfamily\" -and \$desired_productfamilies -eq \$_.Title }).Title
}
#Set desired_productfamilies to blank array if null
if (\$null -eq \$desired_productfamilies) { \$desired_productfamilies = @('') }
# get current enabled product families, blank array if none
\$currentEnabledProductFamilies = (\$wsusServerSubscription.GetUpdateCategories() | Where-Object {\$_.type -eq \"productfamily\"}).Title
if (\$null -eq \$currentEnabledProductFamilies) { \$currentEnabledProductFamilies = @('') }
Expand Down