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

Windows10执行winrm quickconfig报500 0x1F4错误:变量未定义

解决Windows 10 22H2中PowerShell远程启用失败的问题

重置WinRM核心配置

  • 停止WinRM服务:
    Stop-Service WinRM
    
  • 删除WinRM缓存配置文件:
    Remove-Item -Path "C:\Windows\System32\config\systemprofile\.wsman" -Recurse -Force
    
  • 清理WinRM相关注册表项(操作前建议备份注册表):
    reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN" /f
    reg delete "HKLM\SOFTWARE\Microsoft\WinRM" /f
    
  • 重启WinRM服务:
    Start-Service WinRM
    

手动创建HTTP监听器

  • 先检查现有监听器状态:
    Get-WSManInstance -ResourceURI winrm/config/listener -Enumerate
    
  • 若未发现HTTP监听器,手动添加:
    New-WSManInstance -ResourceURI winrm/config/listener -SelectorSet @{Address="*"; Transport="HTTP"} -ValueSet @{Enabled="true"}
    

修复PowerShell配置文件

  • 删除可能损坏的用户及系统级PowerShell配置文件:
    Remove-Item $PROFILE -Force -ErrorAction SilentlyContinue
    Remove-Item $PROFILE.AllUsersAllHosts -Force -ErrorAction SilentlyContinue
    
  • 无配置文件干扰下重新启用PS远程:
    PowerShell -NoProfile -Command "Enable-PSRemoting -Force"
    

检查系统环境变量

  • 在管理员命令提示符中验证SystemRoot变量:
    set SystemRoot
    
  • 若变量值不为C:\Windows,手动设置:
    setx SystemRoot "C:\Windows" /M
    

验证修复效果

  • 执行快速配置命令确认无报错:
    winrm quickconfig
    
  • 测试WinRM服务连通性:
    Test-WSMan localhost
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 13:24:56