Windows 10: Add-WindowsCapability failed. Error code = 0x800f0954
On Windows 10 workstation.
Wanted to install RSAT: Active Directory Domain Services and Lightweight Directory Tools.
PS C:\WINDOWS\system32> Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online
Add-WindowsCapability : Add-WindowsCapability failed. Error code = 0x800f0954
At line:1 char:1
+ Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-WindowsCapability], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.AddWindowsCapabilityCommand
Got the error 0x800f0954.
To solve it.
Run gpedit.msc.
Set:
Computer Configuration\Administrative Templates\System\Specify settings for optional component installation and component repair
Changed it to "Enabled", and selected "Download repair content and optional features directly from Windows Update".
PS C:\WINDOWS\system32> Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online
Path :
Online : True
RestartNeeded : False
NOTE: Even version 2004, not sure why could not +this feature from:
Settings > Apps > Manage optional features > Add feature