PowerShell / PSDscResources

MIT License
129 stars 53 forks source link

WindowsFeatureSet broken when using member Source #194

Open Igor-X opened 3 years ago

Igor-X commented 3 years ago

Failing to compile when using the Source member of WindowsFeatureSet

Configuration InstallDotNet35
{
    Import-DscResource -ModuleName PSDscResources

    node localhost
    {
        WindowsFeatureSet 'InstallDotNet35' {
            Name   = @('NET-Framework-Core')
            Source = 'C:\Temp\DotNetSrc'
            Ensure = 'Present'
        }
    }
}

The result of attempting to compile is


Configuration: C:\Program Files\PowerShell\Modules\PSDscResources\2.12.0.0\DscResources\WindowsFeatureSet\WindowsFeatureSet.schema.psm1:39 Line | 39 | Configuration WindowsFeatureSet | ~~~~~~~ | The member 'Source' is not valid. Valid members are 'Credential', 'DependsOn', 'Ensure', 'IncludeAllSubFeature', 'LogPath', 'Name', | 'PsDscRunAsCredential'.

InvalidOperation: C:\program files\powershell\7\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3745 Line | 3745 | throw $ErrorRecord | ~~~~~~ | Errors occurred while processing configuration 'InstallDotNet35'.


It looks like there is some conflicting documentation on whether that parameter even exists or not.

It's listed on the microsoft docs page https://docs.microsoft.com/en-us/powershell/scripting/dsc/reference/resources/windows/windowsfeaturesetresource?view=powershell-7#syntax

It's not listed on the GitHub page https://github.com/PowerShell/PSDscResources

It exists as a parameter in the file WindowsFeatureSet.schema.psm1, but isn't listed in the Comment-based Help for that function

nshenoy commented 3 years ago

I hit this issue today. Looks like the WindowsFeatureSet proxies to the MSFT_WindowsFeature resource that lacks the Source property. This seems like a regression as previous functionality has been removed.

PlagueHO commented 3 years ago

The PSDscResources module is intended to be a compatible replacement for the PSDesiredStateConfiguration module resources that come in-box with Windows. However, it does indeed look like the MSFT_WindowsFeature module is missing the Source property in the PSDscResources module.

I'm not sure how this feature has been missed out. An issue is also open on the community maintained version of this module for a similar feature: https://github.com/dsccommunity/xPSDesiredStateConfiguration/issues/700

This should be an easy fix but I'll need to confirm with the team what the release schedule looks like.

JCW-USDA commented 1 year ago

Has this been addresses elsewhere in DSC modules? I have been searching with no luck. This is preventing moving away from older modules. Thanks for any insight