Repository navigation
Get-WindowsOptionalFeature -Online fails on PowerShell from MSIX installation - [Get-WindowsOptionalFeature: Class not registered] #13866
Copy link
Copy link
Open
Labels
Blockedblocked on something external to this repoblocked on something external to this repoIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeOS-WindowsPackage-MSIXIssue occurs with MSIX packageIssue occurs with MSIX packageWG-Maintainers-Buildspecific to affecting the buildspecific to affecting the buildWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group
Description
Steps to reproduce
Get-WindowsOptionalFeature -Online
>Get-WindowsOptionalFeature: Class not registered
get-error
Exception :
Type : System.Runtime.InteropServices.COMException
ErrorCode : -2147221164
TargetSite :
Name : ThrowTerminatingError
DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Message : Class not registered
Source : System.Management.Automation
HResult : -2147221164
CategoryInfo : NotSpecified: (:) [Get-WindowsOptionalFeature], COMException
FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand
InvocationInfo :
MyCommand : Get-WindowsOptionalFeature
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : Get-WindowsOptionalFeature -Online
PositionMessage : At line:1 char:1
+ Get-WindowsOptionalFeature -Online
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Get-WindowsOptionalFeature
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1Expected behavior
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
Get-WindowsOptionalFeature -Online
FeatureName : Printing-PrintToPDFServices-Features
State : Enabled
FeatureName : Windows-Defender-Default-Definitions
State : Disabled
FeatureName : Printing-XPSServices-Features
State : Enabled
...Actual behavior
Error: Get-WindowsOptionalFeature: Class not registered
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.1.0-rc.2
PSEdition Core
GitCommitId 7.1.0-rc.2
OS Microsoft Windows 10.0.20211
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Blockedblocked on something external to this repoblocked on something external to this repoIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeOS-WindowsPackage-MSIXIssue occurs with MSIX packageIssue occurs with MSIX packageWG-Maintainers-Buildspecific to affecting the buildspecific to affecting the buildWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group
Activity
iSazonov commentedon Oct 26, 2020
/cc Dongbo Wang (@daxian-dbw) Patrick Meinecke (@SeeminglyScience) who could comment the exception.
SeeminglyScience commentedon Oct 26, 2020
Ben Wilkinson (@brwilkinson) does it work in Windows PowerShell? I can't repro which makes me lean towards it being an issue with the Windows build you're on.
Can anyone else on the Windows 10 dev channel repro?
SteveL-MSFT commentedon Oct 26, 2020
This works on my system with 7.1-rc2 and Windows 20H2 (build 19042). That COMException simply means the cmdlet is trying to use a COM object that isn't found. @brwilinson, is your repro showing that on the same system 7.0.3 works, but 7.1-rc2 does not?
iSazonov commentedon Oct 26, 2020
I believe it is better to use Windows Feedback tool to report the issue.
brwilkinson commentedon Oct 26, 2020
Steve Lee (@SteveL-MSFT) yes correct
$PSVersionTable
PSVersion 5.1.20211 <-- works as expected
PSVersion 7.0.3 <-- works as expected
PSVersion 7.1.0-rc.2 <-- hangs for quite a while (assuming a COM timeout), then fails with the COMException.
Repros on both of my main machines.
My second machine is running a later version: Microsoft Windows 10.0.20241
rjmholt commentedon Oct 27, 2020
I just tried this on my machine:
Two things Ben Wilkinson (@brwilkinson):
Because this is done by Dism, which touches COM directly itself (rather than going through PowerShell), this may be caused by changes in .NET rather than in PowerShell.
brwilkinson commentedon Oct 27, 2020
I am OOF at the moment, can test it when back on keyboard.
Rob Holt (@rjmholt) by any chance could you test with the store Preview msix version.
SteveL-MSFT commentedon Oct 27, 2020
Ok, I can repro this from Store installed one. I suspect it's due to registry virtualization which isn't supposed to be active.
[-]Get-WindowsOptionalFeature -Online fails on 7.1.0-rc.2 - [Get-WindowsOptionalFeature: Class not registered][/-][+]Get-WindowsOptionalFeature -Online fails on 7.1.0-rc.2 (MSIX)- [Get-WindowsOptionalFeature: Class not registered][/+]51 remaining items
SteveL-MSFT commentedon May 8, 2026
We're working with Windows team on this as the fix isn't in PS7
brwilkinson commentedon May 25, 2026
This is the default install method for pwsh now isn't it?
That's a bit unfortunate.. 😂
Maybe for the best, given this issue had aged, could be good motivation to get it resolved 🤞
teamiisjonathon commentedon May 26, 2026
This is garbage. Winget is suppose to be pulling the same binary that is on the Microsoft Download page. If you uninstall the winget version and install the MSI from the Microsoft page , this issue is resolved. Why is it that Microsoft's "fix" tends to be an uninstall and re-install. The winget Microsoft packages should be verified and tested before being put out in the wild!
linghengqian commentedon May 30, 2026
I feel like I've traveled through time. I clearly remember that in 2024 and 2025, I could do this.
However, starting sometime in 2026, I will receive an error message like "Class not registered",
The only issue I could find was the current one, which turned out to have existed since 2020. This is completely contrary to my memories of 2024 and 2025.
update in 2026.05.30: I think I know the reason now. 😇See https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows?view=powershell-7.6#install-powershell-using-winget .
Karl-WE commentedon Jul 29, 2026
Steve Lee (@SteveL-MSFT) do I understand correctly that Windows Server / Servicing team is responsible for the fix in DISM module, discussed in this thread?
If yes,
will this address it for both Windows Client and Windows Server OS?
kilasuit commentedon Jul 30, 2026
Karl Wester-Ebbinghaus (@Karl-WE) it should however this is all dependent on release cycles. Also I don't think that it is likely to be seen as a security fix which would stop it coming in the usual patch Tuesday cycle.
I'd expect it to show in one of the Windows Client Insider builds before it lands in any of the general use builds of Windows Client.
But yes that would be my expectation, however the "when" that's unfortunately the million (currency of your choice) question.
SteveL-MSFT commentedon Aug 10, 2026
Expectation is that this will be address for both Windows Client and Server OS
Karl-WE commentedon Aug 11, 2026
Steve Lee (@SteveL-MSFT) that's great news. Fingers crossed there will be a good solution and backport to WS2022 as long it's in mainstream support, to avoid friction across the fleet.
There is an issue open which is collecting all the regressions known with MSIX. I have a question,
There are some details missing and I wonder if we have to raise an issue for every item so it can be tracked better. Or it is okay to comment below the collection. I like that question because, mscx and a dism command is stated, and I expanded in the comments below that there are other commands affected in the same module.
Generally speaking I know it's not your area but I would appreciate if I could get in touch with the team working on the dism module. I've realized two to three commands that are missing in the module which made it impossible to adopt this module as a successor to the native dism commands, install the adoption rate of the module is low and also in the official documentation and other parts of products it is rather the case that Microsoft is still using native commands instead of the PowerShell. Maybe it's naive but I'm thinking it's a good opportunity if there are on it anyway they could add this three commands that I have in mind I see missing which is causing a blocker to adopt it.
I hope you are great that I'm commenting on this year it's at least remote related to the dism/ msix.
bogdan-patraucean commentedon Sep 4, 2026
Steve Lee (@SteveL-MSFT) any updates? This seems to be an issue using DISM API in any packaged MSIX app, not just powershell.
mamoreau-devolutions commentedon Sep 23, 2026
I'm setting up a new laptop and hitting this problem. PowerShell 7.7 is just around the corner and drops the MSI installer. This needs to be prioritized
Support DISM in host initialization with MSIX PowerShell (#98)
HotCakeX commentedon Sep 24, 2026
Just a reminder that this is not a problem in PowerShell or Windows. You just have to use the DISM APIs correctly in packaged apps. I shared how to do it above, and in this article: https://github.com/HotCakeX/Harden-Windows-Security/wiki/DISM-API-in-Packaged-Apps-and-the-Mechanics-of-Child-Process-Identity
Windows offers built-in and documented APIs to use it. At most, the change will need to happen in the DISM component itself, not Windows and not PowerShell.
There is no reason to wait for any fix when you can use DISM in packaged apps right now.
pcroc commentedon Oct 13, 2026
This is quite an easy trap to fall into.
The Install Powershell 7 on Windows page suggests:
(the third option of MSIX package explicitly states An easy way to install for casual users of PowerShell but has limitations)
On the WinGet page, the first suggestion is:
with a note above: Beginning with the winget package for PowerShell 7.6.0, winget installs the MSIX package by default