UpdateServicesDsc icon indicating copy to clipboard operation
UpdateServicesDsc copied to clipboard

UpdateServicesApprovalRule: Broken verbose output

Open MartinVokurek opened this issue 4 years ago • 0 comments

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

Verbose output of Get-TargetResource returns Microsoft.UpdateServices.Internal.BaseApi.UpdateServer instead of WSUS server name

Verbose logs showing the problem

VERBOSE: [SRV1]: LCM:  [ Start  Resource ]  [[UpdateServicesApprovalRule]Approval]
VERBOSE: [SRV1]: LCM:  [ Start  Test     ]  [[UpdateServicesApprovalRule]Approval]
VERBOSE: [SRV1]:                            [[UpdateServicesApprovalRule]Approval] Identified WSUS server information: Microsoft.UpdateServices.Internal.BaseApi.UpdateServer
VERBOSE: [SRV1]: LCM:  [ End    Test     ]  [[UpdateServicesApprovalRule]Approval]  in 0.0470 seconds.
VERBOSE: [SRV1]: LCM:  [ Skip   Set      ]  [[UpdateServicesApprovalRule]Approval]
VERBOSE: [SRV1]: LCM:  [ End    Resource ]  [[UpdateServicesApprovalRule]Approval]

Suggested solution to the issue

https://github.com/dsccommunity/UpdateServicesDsc/blob/dd6be4e15d88399dc9152364b0b80ef270f329a0/source/DSCResources/MSFT_UpdateServicesApprovalRule/MSFT_UpdateServicesApprovalRule.psm1#L55

Change the line to:

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

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 {

        UpdateServicesApprovalRule Approval {
            Ensure = 'Present'
            Name = 'Test Approval Rule'
            Classifications = @(
                # Updates
                'cd5ffd1e-e932-4e3a-bf74-18bf0b1bbd83'
            )
            Products = 'Windows Server 2016'
            ComputerGroups = 'All Computers'
            Enabled = $true
        }
    }
}

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

MartinVokurek avatar Feb 12 '21 19:02 MartinVokurek