Get-WindowsOptionalFeature Failing to Work

10,559
  1. The Get-WindowsOptionalFeature cmdlet requires PowerShell 3.0.
  2. This cmdlet must run with elevated rights. Right-click the Windows PowerShell 3.0 console while holding the CTRL key, and select Run As Administrator from the action menu (per: https://blogs.technet.microsoft.com/heyscriptingguy/2012/08/24/use-powershell-3-0-to-find-enabled-windows-8-features/).
  3. The RSAT must be installed in order to use it. I don't think it has anything at all to do with 32-bit vs 64-bit.
Share:
10,559
Martin Boros
Author by

Martin Boros

Updated on August 20, 2022

Comments

  • Martin Boros
    Martin Boros over 1 year

    I'm playing around with IIS and Windows PowerShell, and based on this this Microsoft TechNet link I should be able to view all optional features for my OS with the PowerShell command:

    PS C:\> Get-WindowsOptionalFeature –Online
    

    When I try to use this command, I get this error message:

    get-windowsoptionalfeature : An attempt was made to load a program with an incorrect format.
    At line:1 char:1
    + get-windowsoptionalfeature -Online
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-WindowsOptionalFeature], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand
    

    I've been reading around and most issues seem to be based on problems between 64-bit and 32-bit OS's, I've tried running it in both my standard PowerShell and PowerShell (x86), same error in both. Any ideas on why this is happening?

  • Martin Boros
    Martin Boros over 7 years
    Okay, reading up on it RSAT does not work on Windows 10 Home Edition, which is the version I'm using. So I guess I'm locked out of features like this?
  • T-Heron
    T-Heron over 7 years
    The RSAT must be installed, which unfortunately means you can't use it. If I worked in Microsoft, I would have decided differently. Lots of good use cases such as yours for this tool on Home Edition. Please don't forget to "accept" the answer so that it may help others when searching for the same question.
  • NealWalters
    NealWalters about 4 years
    Had same error in 32-bit, but not 64-bit on Windows Server 2016.