Get-WindowsOptionalFeature -Online fails on PowerShell from MSIX installation - [Get-WindowsOptionalFeature: Class not registered] #13866
Description
Activity
- addedIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
on Oct 25, 2020 Type : System.Runtime.InteropServices.COMException ErrorCode : -2147221164/cc Dongbo Wang (@daxian-dbw) Patrick Meinecke (@SeeminglyScience) who could comment the exception.
SeeminglyScience commented
on Oct 26, 2020 ContributorMore actionsBen 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?
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?
Microsoft Windows 10.0.20211
I believe it is better to use Windows Feedback tool to report the issue.
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.Get-WindowsOptionalFeature: Class not registered
Repros on both of my main machines.
My second machine is running a later version: Microsoft Windows 10.0.20241
I just tried this on my machine:
> systeminfo | select -first 2 -skip 2 OS Name: Microsoft Windows 10 Enterprise Insider Preview OS Version: 10.0.21246 N/A Build 21246 > Get-WindowsOptionalFeature -Online FeatureName : Printing-PrintToPDFServices-Features State : Enabled FeatureName : Windows-Defender-Default-Definitions State : Disabled FeatureName : Printing-XPSServices-Features State : Enabled ...Two things Ben Wilkinson (@brwilkinson):
- Can you try to reproduce on a newer version of Windows?
- Can you try with PS 7.1-preview.5?
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.
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.
- That is one other variable that we should check first.
Reacted by Rob HoltOk, I can repro this from Store installed one. I suspect it's due to registry virtualization which isn't supposed to be active.
Reacted by Michael Grafnetter, Edificom SA, sriharsha-gundavarapu-git and Khaled J- changed the title
[-]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][/+]on Oct 27, 2020 - addedIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productand removedIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
on Oct 27, 2020 - addedWG-Maintainers-Buildspecific to affecting the buildspecific to affecting the build
on Oct 28, 2020 50 remaining items
Also in PowerShell 7.7.0-preview.1:
Get-WindowsOptionalFeature Add-AppxProvisionedPackage- addedBlockedblocked on something external to this repoblocked on something external to this repo
on May 8, 2026 We're working with Windows team on this as the fix isn't in PS7
Reacted by zotabee and Karl Wester-EbbinghausReacted by Bogdan PătrăuceanThis 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 🤞
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!
Reacted by Tatsunori Uchino and Khaled JI feel like I've traveled through time. I clearly remember that in 2024 and 2025, I could do this.
# Open Windows PowerShell winget install --id Microsoft.PowerShell --source winget --exact # Open PowerShell 7 with administrator privileges Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
However, starting sometime in 2026, I will receive an error message like "Class not registered",
PS C:\Users\lingh> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All Enable-WindowsOptionalFeature: 没有注册类 PS C:\Users\lingh> Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online Enable-WindowsOptionalFeature: 没有注册类 PS C:\Users\lingh>
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 .
Beginning with the winget package for PowerShell 7.6.0, winget installs the MSIX package by default.
Reacted by Karl Wester-Ebbinghaus- marked DISM cmdlets not working in Powershell 7 #15428 as a duplicate of this issue
on Jun 26, 2026 We're working with Windows team on this as the fix isn't in PS7
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?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.
Reacted by Karl Wester-Ebbinghaus and Khaled JWe're working with Windows team on this as the fix isn't in PS7
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?
Expectation is that this will be address for both Windows Client and Server OS
Reacted by Karl Wester-EbbinghausSteve 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 commented
on Sep 4, 2026 More actionsSteve Lee (@SteveL-MSFT) any updates? This seems to be an issue using DISM API in any packaged MSIX app, not just powershell.
mamoreau-devolutions commented
on Sep 23, 2026 More actionsI'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
- added a commit that references this issue
on Sep 23, 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.
Harden Windows Safely, Securely using Official Supported Microsoft methods and proper explanation | Always up-to-date and works with the latest build of Windows | Provides tools and Guides for Pers...Reacted by coniohReacted by Karl Wester-Ebbinghaus
Steps to reproduce
Expected behavior
Actual behavior
Environment data