This seems to have been a common problem but I don't know if still is.
Is the server running the latest updates?
Have you tried adding the -LimitAccess switch to the Add-WindowsCapability cmdlet?
Do you have this registry value set to something other than zero (0)?
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
I think this may do the same as adding the -LimitAccess switch: add-windowscapability-failed-error-code-0x800f0954
Have you checked the DISM log (C:\Windows\Logs\DISM\dism.log) after the Add-WindowsCapability fails to add the capability?
Ultimately, I don't think this is a PowerShell problem, though.