Skip to content

UpdateServicesServer, UpdateServicesApprovalRule: Allow use of friendly names or GUIDs in Products, Classifications #65

@MartinVokurek

Description

@MartinVokurek

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

This is for both the UpdateServicesServer and UpdateServicesApprovalRule resources:
The Products property currently accepts friendly names while Classifications accepts GUIDs. GUIDs are not overly easy to work with. Given that there's already code to translate Titles to GUIDs for Products, the same approach could be used for Classifications as well.

I am aware that this has already been discussed in #18

Verbose logs showing the problem

Suggested solution to the issue

To avoid language dependency, as well as to avoid the introduction of breaking change, the properties could be made to accept both friendly names as well as GUIDs. The desired values could be compared against Title or ID.

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

# This works OK
Configuration WSUSProduct {
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
    Import-DscResource -ModuleName 'UpdateServicesDsc' -ModuleVersion 1.2.1
    
    Node localhost {
 
        UpdateServicesServer WSUS {
            Ensure = 'Present'
            Languages = 'en'

            # Classification must be a GUID
            Classifications = '0fa1201d-4330-4fa8-8ae9-b877473b6441' # Security Updates

            # Products use Title
            Products = 'Windows Server 2016'
        }
    }
}

# This does not work
Configuration WSUSProduct {
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
    Import-DscResource -ModuleName 'UpdateServicesDsc' -ModuleVersion 1.2.1
    
    Node localhost {
 
        UpdateServicesServer WSUS {
            Ensure = 'Present'
            Languages = 'en'

            # Title can't be used in Classifications
            Classifications = 'Security Updates'

            # GUIDs can't be used in Products 
            Products = '569e8e8f-c6cd-42c8-92a3-efbb20a0f6f5' # 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