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

PowerShell 7执行Get-Service时McpManagementService无法查询的解决办法

解决PowerShell 7中Get-Service查询McpManagementService失败的问题

你执行的命令:

PS C:\Users\MYUSER> $myoutput = get-service| where-Object Status -eq "Stopped"| select-Object Name, Status

遇到的错误:

Get-Service: Service 'McpManagementService (McpManagementService)' cannot be queried due to the following error:

以下是几种可行的解决办法:

  • 跳过报错的服务,继续获取其他结果
    使用-ErrorAction SilentlyContinue参数让PowerShell忽略查询失败的服务,继续执行后续操作:

    $myoutput = Get-Service -ErrorAction SilentlyContinue | Where-Object Status -eq "Stopped" | Select-Object Name, Status
    

    如果需要记录错误信息,可以改用-ErrorAction Continue或者捕获错误到变量:

    $errors = @()
    $myoutput = Get-Service -ErrorAction SilentlyContinue -ErrorVariable errors | Where-Object Status -eq "Stopped" | Select-Object Name, Status
    # 查看错误详情
    $errors
    
  • 排查McpManagementService本身的问题

    1. 先尝试单独查询该服务,获取完整错误信息:
      Get-Service -Name McpManagementService -ErrorAction Stop
      
    2. 打开服务管理器(运行services.msc),查找McpManagementService:
      • 如果该服务不存在,说明是系统残留的无效服务条目,可以用管理员权限执行以下命令删除:
        sc delete McpManagementService
        
      • 如果服务存在,检查服务的权限设置,确保当前用户有读取服务状态的权限。
  • 以管理员身份运行PowerShell 7
    部分系统服务需要管理员权限才能查询,右键点击PowerShell 7图标,选择「以管理员身份运行」,再执行原命令尝试。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 13:34:59