Skip to content

[UpdateServicesServer] Products test return false after set #47

@phoenix2pm

Description

@phoenix2pm

Details of the scenario you tried and the problem that is occurring

Some Wsus products have non ASCII characters in their Title. In particular "Windows Server Manager – Windows Server Update Services (WSUS) Dynamic Installer" dash (" - ") is not in ASCII format therefore comparison is failing subsequently test and set is failing.

Verbose logs showing the problem

Suggested solution to the issue

Suggested solution to strip all none alphanumerical characters using this method: ToCharArray().Where{ $_ -imatch "[a-z0-9]" } -join '' i.e. like this:

foreach ($Product in $Products) {
                   # Due to none ASCII characters used in Product titles in particular "Windows Server Manager – Windows Server Update Services (WSUS) Dynamic Installer" dash (" - ") is not in ASCII format
                   # had to strip all none alphanumerical characters to compare the titles. to do so used this method: ToCharArray().Where{ $_ -imatch "[a-z0-9]" } -join '' 
                   if ($WsusProduct = $AllWsusProducts | Where-Object { ($_.Title.ToCharArray().Where{ $_ -imatch "[a-z0-9]" } -join '') -eq ($Product.ToCharArray().Where{ $_ -imatch "[a-z0-9]" } -join '') }) {
                       Write-Verbose "Setting WSUS Product: $($Product)"
                       $null = $ProductCollection.Add($WsusServer.GetUpdateCategory($WsusProduct.Id))
                   }
               }

The DSC configuration that is used to reproduce the issue (as detailed as possible)

products                          = @(
            'ASP.NET Web and Data Frameworks'
            'ASP.NET Web Frameworks'
            'Azure File Sync agent updates for Windows Server 2016'
            'Windows Server 2016 and Later Servicing Drivers'
            'Windows Server 2016'
            'Windows Server Manager - Windows Server Update Services (WSUS) Dynamic Installer'
        )

The operating system the target node is running

Version and build of PowerShell the target node is running

Version of the DSC module that was used ('dev' if using current dev branch)

master branch
version: 1.1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions