PSDscResources icon indicating copy to clipboard operation
PSDscResources copied to clipboard

WindowsFeatureSet broken when using member Source

Open Igor-X opened this issue 3 years ago • 3 comments

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

Igor-X avatar Oct 21 '20 23:10 Igor-X

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.

nshenoy avatar May 03 '21 18:05 nshenoy

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.

PlagueHO avatar May 03 '21 22:05 PlagueHO

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

JCW-USDA avatar May 10 '23 18:05 JCW-USDA