When using DISM.exe to get Windows optional features using command dism /Online /Get-Features
, the program exits within 1 second and outputs the right results. But when using the command Get-WindowsOptionalFeature -Online
in powershell, it stucks for minutes and finally returns nothing or returns an error saying Get-WindowsOptionalFeature: Class not registered
Windows version: Windows 11 22H2 Professional (22624.1616)
Powershell version: 7.3.4
DISM version: 10.0.22621.1
I searched on Bing for information, but it seems that nobody is encountering the same issue. I thought about maybe the server is far away, so I used a proxy but nothing changed.
Added
I've found a relative issue on GitHub: PowerShell/PowerShell#13866