xPSDesiredStateConfiguration
xPSDesiredStateConfiguration copied to clipboard
Missing ALL parameter in cWindowsOptionalFeature
cWindowsOptionalFeature doesn't support parameter "ALL" that will install all parent features, which may result in errors during installation and require more detailed configurations. Would be great if this parameter would be added.
This repository doesn't have any control over cWindowsOptionalFeature. Do you mean xWindowsOptionalFeature?
And I'm not sure what you mean by install all parent features. Do you mean install all dependencies?
https://technet.microsoft.com/en-us/itpro/powershell/windows/dism/enable-windowsoptionalfeature#-all
There are some dependencies between features. e.g. if you run
Get-WindowsFeature | Where Name -match "Net-Frame"
You will see that features organized in a tree according to the dependencies.
You won't be able to install NET-FRAMEWORK-CORE, if you do not have NET-FRAMEWORK-FEATURES
@asmagin Could you please provide a configuration that reproduces your problem, to see if there is a way to make a tests to see how this can be solved.
I was quite a while ago, but I believe that Windows 2012 R2 clean installation should not have the latests framework installed. Try to install NET-FRAMEWORK-CORE feature there. It should fail.
Started out uninstalled:
Display Name Name Install State
------------ ---- -------------
[ ] .NET Framework 3.5 Features NET-Framework-Features Available
[ ] .NET Framework 3.5 (includes .NET 2.0 and 3.0) NET-Framework-Core Available
Running this configuration:
xWindowsFeature $resourceConfigName {
Name = 'NET-Framework-Core'
Ensure = 'Present'
}
Resulted in:
Display Name Name Install State
------------ ---- -------------
[X] .NET Framework 3.5 Features NET-Framework-Features Installed
[X] .NET Framework 3.5 (includes .NET 2.0 and 3.0) NET-Framework-Core Installed
Updated to correct resource name.
We could also have added both to make sure both are always in desired state.
xWindowsFeature $resourceConfigName {
Name = 'NET-Framework-Features'
Ensure = 'Present'
}
xWindowsFeature $resourceConfigName {
Name = 'NET-Framework-Core'
Ensure = 'Present'
}
Closing this issue at this time.
@johlju As I told you the issues was reported 2 years ago and some details are blurry, but I looked through the code of module and link that I posted above.
xWindowsOptionalFeature
uses dism inside. I believe it is used not on server but on 8, 8.1 and maybe on 10. According to the documentation of dism you can pass -All flag to ensure that dependencies will be installed. And the module is not passing this parameter.
https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/33d8027aae3fa7aeda22a7f4d1643f027aaa5c3f/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.psm1#L138-L143
PS: just noticed that you are testing different resource in your example.
Yes I saw that I tested the wrong resource too :smile: As per your previous comment I reopen this and label it as an enhancement and help wanted.
You can add All switch similar to [Boolean] $IncludeAllSubFeature = $false,
in function you actually tested:
https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/33d8027aae3fa7aeda22a7f4d1643f027aaa5c3f/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.psm1#L194-L198