Martin Boros
Martin Boros

Reputation: 798

Get-WindowsOptionalFeature Failing to Work

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?

Upvotes: 6

Views: 13513

Answers (1)

T-Heron
T-Heron

Reputation: 5584

  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.

Upvotes: 7

Related Questions