You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recent Windows Server versions allow for adding, querying, and removing Windows capabilities which are separate from features, optional features, and packages. For example, to check the installation status of OpenSSH SSH Server (sshd) on Windows Server 2022 and install it if not installed already one could do:
if (Get-WindowsCapability -Name OpenSSH.Server -Online | ? State -ne 'Installed') {Add-WindowsCapability -Name OpenSSH.Server -Online}
It would be helpful if there would be an Ansible Windows module available to do this without the need for writing PowerShell.
ISSUE TYPE
Feature Idea
COMPONENT NAME
win_capability
ADDITIONAL INFORMATION
The Add-WindowsCapability, Get-WindowsCapability, and Remove-WindowsCapability PowerShell cmdlets seem to use Dism.exe. While the aforementioned example works as expected on Windows Server 2022 it doesn't seem to do anything on Windows 10. Also, when trying to install other capabilities such as languages the results seem inconsistent, I haven't been able to handle them reliably even if similar language enablement using Settings works as expected. Meaning that if creating this kind of module it should verify the outcome to the extent possible.
For reference, here are the most relevant documents available online, the DISM commands and PowerShell cmdlets use the term capability but the documents talk about Features on Demand (FODs):
I think the issue I mentioned earlier about inconsistent results was probably due to a typo somewhere. For example, trying to install 'OpenSSH-Server~~~~0.0.1.0' doesn't really do anything but does not give a clear error either as some might except due to using wrong name, it should be 'OpenSSH.Server~~~~0.0.1.0' not 'OpenSSH-Server~~~~0.0.1.0'. Thanks.
This is certainly something we should probably look into. Things like invalid names should of course be detected and produce an error with a more obvious reason why it failed.
SUMMARY
Recent Windows Server versions allow for adding, querying, and removing Windows capabilities which are separate from features, optional features, and packages. For example, to check the installation status of OpenSSH SSH Server (sshd) on Windows Server 2022 and install it if not installed already one could do:
It would be helpful if there would be an Ansible Windows module available to do this without the need for writing PowerShell.
ISSUE TYPE
COMPONENT NAME
win_capability
ADDITIONAL INFORMATION
The Add-WindowsCapability, Get-WindowsCapability, and Remove-WindowsCapability PowerShell cmdlets seem to use Dism.exe. While the aforementioned example works as expected on Windows Server 2022 it doesn't seem to do anything on Windows 10. Also, when trying to install other capabilities such as languages the results seem inconsistent, I haven't been able to handle them reliably even if similar language enablement using Settings works as expected. Meaning that if creating this kind of module it should verify the outcome to the extent possible.
The text was updated successfully, but these errors were encountered: