You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DISM.exe正常运行但PowerShell的Get-WindowsOptionalFeature命令失败求助

问题:PowerShell Get-WindowsOptionalFeature 命令卡顿无响应或报错

执行dism /Online /Get-Features可在1秒内返回Windows可选功能的正确结果,但在PowerShell 7.3.4中执行Get-WindowsOptionalFeature -Online时,会卡顿数分钟,最终要么无返回结果,要么弹出错误提示:

Get-WindowsOptionalFeature: Class not registered

环境信息

Windows版本:Windows 11 22H2 专业版(22624.1616)
PowerShell版本:7.3.4
DISM版本:10.0.22621.1

已尝试的排查动作

  • 通过Bing搜索相关信息,未找到完全匹配的案例
  • 曾怀疑服务器距离导致延迟,尝试使用代理,无效果

相关问题及可行解决方法

在PowerShell官方项目中存在同类问题,核心原因是PowerShell 7.x作为跨平台版本,其Get-WindowsOptionalFeature cmdlet依赖的DISM COM组件在部分Windows 11环境下未正确注册,或存在架构不匹配情况。社区总结的可行方案如下:

  • 改用Windows PowerShell 5.1执行:打开系统自带的Windows PowerShell(而非PowerShell 7),运行Get-WindowsOptionalFeature -Online,多数场景下可正常返回结果
  • 重新注册DISM相关COM组件:以管理员身份打开命令提示符,依次执行以下命令:
    regsvr32.exe %systemroot%\system32\wbem\wmiutils.dll
    regsvr32.exe %systemroot%\system32\wbem\wbemdisp.dll
    
  • 用DISM命令替代PowerShell cmdlet:既然dism /Online /Get-Features可正常运行,可直接基于该命令的输出做后续处理,例如通过以下命令提取关键信息:
    dism /Online /Get-Features | Select-String "Feature Name :|State :"
    

内容的提问来源于stack exchange,提问作者CarlGao4

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 21:18:22