puppet-windowsfeature
puppet-windowsfeature copied to clipboard
Support for Windows Capabilities
Would you consider adding *-WindowsCapability cmdlet support to the windowsfeature type/provider?
It looks like those cmdlets were available starting from Server 2016 based on https://docs.microsoft.com/en-us/powershell/module/dism/get-windowscapability?view=windowsserver2016-ps and https://docs.microsoft.com/en-us/powershell/module/dism/add-windowscapability?view=windowsserver2016-ps
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 7.8.0
- Ruby: 2.7.3
- Distribution: Windows Server 2019 Standard
- Module version: 3.2.2
How to reproduce (e.g Puppet code you use)
As a user, I'd like to be able to apply the puppet code below, so that I can use this module to install Windows Capabilities.
Example:
windowsfeature { 'OpenSSH.Server~~~~0.0.1.0':
ensure => present,
}
What are you seeing
The module is currently unable to ensure the windows capability.
What behaviour did you expect instead
To install the desired Windows Capability.
Output log
PS C:\Users\Administrator> puppet resource windowsfeature OpenSSH.Client~~~~0.0.1.0
windowsfeature { 'OpenSSH.Client~~~~0.0.1.0':
ensure => 'absent',
provider => default,
}
PS C:\Users\Administrator> puppet apply -e "windowsfeature { 'OpenSSH.Server~~~~0.0.1.0': ensure => present, }"
Notice: Compiled catalog for localhost in environment production in 0.10 seconds
Error: Execution of 'C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature OpenSSH.Server~~~~0.0.1.0' returned 1: Install-WindowsFeature : ArgumentNotValid: The role, role service, or feature name is not valid:
'OpenSSH.Server~~~~0.0.1.0'. The name was not found.
At line:1 char:30
+ ... odule ServerManager; Install-WindowsFeature OpenSSH.Server~~~~0.0.1.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (OpenSSH.Server~~~~0.0.1.0:String) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : NameDoesNotExist,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
False No InvalidArgs {}
Error: /Stage[main]/Main/Windowsfeature[OpenSSH.Server~~~~0.0.1.0]/ensure: change from 'absent' to 'present' failed: Execution of 'C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe Import-Module ServerManager; Install-WindowsFeature OpenSSH.Server~~~~0.0.1.0' returned 1: Install-WindowsFeature : ArgumentNotValid: The role, role service, or feature name is not valid:
'OpenSSH.Server~~~~0.0.1.0'. The name was not found.
At line:1 char:30
+ ... odule ServerManager; Install-WindowsFeature OpenSSH.Server~~~~0.0.1.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (OpenSSH.Server~~~~0.0.1.0:String) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : NameDoesNotExist,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
False No InvalidArgs {}
Notice: Applied catalog in 1.40 seconds
Any additional information you'd like to impart
I might be able to help work on this in my spare time, but wanted to see if you were open to adding this feature to the module first.
Thanks!