Skip to content

UpdateServicesServer: Verbose output broken for Languages #62

Closed
@MartinVokurek

Description

@MartinVokurek

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

Verbose output of Languages property is broken in Test-TargetResource, it returns System.Collections.Specialized.StringCollection instead of list of languages

Verbose logs showing the problem

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Mi
crosoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer SRV1 with user sid S-1-5-21-2574420874-2490326428-1586090461-500.
VERBOSE: [SRV1]: LCM:  [ Start  Set      ]
VERBOSE: [SRV1]: LCM:  [ Start  Resource ]  [[UpdateServicesServer]WSUS]
VERBOSE: [SRV1]: LCM:  [ Start  Test     ]  [[UpdateServicesServer]WSUS]
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUS server.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] WSUS server is Present.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUS server configuration.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WUSS server subscription.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUS SQL server.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] WSUS Server SQL Server is MICROSOFT##WID.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUSServer content directory.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] WSUS Server content directory is E:\.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUSServer update improvement program.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] WSUS Server content update improvement program is False.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] Getting WSUS Server languages.
VERBOSE: [SRV1]:                            [[UpdateServicesServer]WSUS] WSUS Server languages are System.Collections.Specialized.StringCollection.

...

Suggested solution to the issue

Write-Verbose -Message $script:localizedData.GettingWsusLanguage
if ($WsusConfiguration.AllUpdateLanguagesEnabled)
{
$Languages = @('*')
}
else
{
$Languages = $WsusConfiguration.GetEnabledUpdateLanguages()
}
Write-Verbose -Message ($script:localizedData.WsusLanguages -f $Languages)

Adjust line 124 to:

$Languages = ($WsusConfiguration.GetEnabledUpdateLanguages()) -join ','

...to transform the string collection into a simple string.

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

Configuration WSUSProduct {
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
    Import-DscResource -ModuleName 'UpdateServicesDsc' -ModuleVersion 1.2.1
    
    Node localhost {
 
        UpdateServicesServer WSUS {
            Ensure = 'Present'
            Languages = 'en'
            Products = 'Windows Server 2016'
        }
    }
}

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value                                                                                                                                                    
----                           -----                                                                                                                                                    
PSVersion                      5.1.17763.1490                                                                                                                                           
PSEdition                      Desktop                                                                                                                                                  
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                  
BuildVersion                   10.0.17763.1490                                                                                                                                          
CLRVersion                     4.0.30319.42000                                                                                                                                          
WSManStackVersion              3.0                                                                                                                                                      
PSRemotingProtocolVersion      2.3                                                                                                                                                      
SerializationVersion           1.1.0.1 

Version of the DSC module that was used

Name              Version Path                                                                                       
----              ------- ----                                                                                       
UpdateServicesDsc 1.2.1   C:\Program Files\WindowsPowerShell\Modules\UpdateServicesDsc\1.2.1\UpdateServicesDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions