I am trying to install OpenSSH on a Windows Server 2019 machine in an environment without external network access and with a configured proxy at "". I am using PowerShell with administrative privileges and have set the HTTP_PROXY and HTTPS_PROXY environment variables as follows:
$Proxy = "" $ENV:HTTP_PROXY=$proxy $ENV:HTTPS_PROXY=$proxy However, when I try to install OpenSSH using the following command:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 I receive the following error:
Add-WindowsCapability : Add-WindowsCapability failed. Error code = 0x800f0954 At line:1 char:1 + Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Add-WindowsCapability], COMException + FullyQualifiedErrorId : Microsoft.Dism.Commands.AddWindowsCapabilityCommand Other Invoke-WebRequests I am making seem to have proxy access, but the Add-WindowsCapability command is not working. I am unable to resolve this issue.
2 Answers
The message has error code 0x800f0954, you may want try doing the following steps:
- Open
gpedit.msc - Navigate to Computer Configuration -> Administrative Templates -> System
- Double click on
Specify settings for optional component installation and component repairto open its settings - Check "Enabled" in the popup dialog
- Check
Download repair content and optional features directly from Windows Updates instead of Windows Server Updates Services (WSUS) - Open Powershell, Run
gpupdate /force - Rerun the
Add-WindowsCapabilityagain, it should be fixed
I want to share my solution. I searched a lot to solve this issue, because I wanted to solve this without changing the Group Policy's and wanted to use the CAB file as Source.
I used the following command:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 -Source {path to the cab file} -LimitAccess Every time I got an error. But then I looked at the logfile: C:\Windows\Logs\CBS\cbs.log and realized that I used the wrong version of the CAB file. In the log file you can also see the expected version. After downloading the right version, everything worked as expected!