Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I utilize the Add-WindowsCapability function through a proxy in PowerShell?

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 "http://10.99.99.99:80". I am using PowerShell with administrative privileges and have set the HTTP_PROXY and HTTPS_PROXY environment variables as follows:

$Proxy = "http://10.99.99.99:80"
$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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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 repair to 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-WindowsCapability again, it should be fixed
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading