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

WinRM连接异常求助:JSystem适配Win10环境问题定位与解决

Troubleshooting WinRM Connection Issues Between Jenkins (Windows Server 2008) and Windows 10 VM for JSystem Tests

Hey there, let's work through this WinRM issue you're hitting with JSystem, Jenkins, and your Win10 VM. Since JSystem's native Telnet support doesn't work on Win10 anymore, switching to WinRM makes sense—but vague symptoms make troubleshooting tricky. Let's break this down step by step to define, locate, and fix the problem.

Step 1: First, Define the Exact Problem

Before we dive into fixes, we need concrete details about what's failing. Here's how to capture that:

  • Check all relevant logs: Jenkins build logs, JSystem test execution logs, and the Win10 VM's Event Viewer (look under Windows Logs > System and Applications for WinRM-related errors). Note any error messages, codes, or timestamps.
  • Test the WinRM connection manually outside JSystem to isolate if it's a tool-specific issue or a core WinRM problem:
    On your Windows Server 2008 Jenkins machine, open Command Prompt and run:
    winrm id -r:your-win10-vm-ip -u:your-win10-admin-username -p:your-password
    
    Write down every error or success message you get here—this will be key to narrowing things down.

Step 2: Check WinRM Configuration on Both Machines

WinRM has strict security rules, especially between older Windows Server 2008 and newer Win10. Let's verify these critical settings:

On the Windows 10 VM (the test target):

  1. Enable WinRM if you haven't already. Open an elevated PowerShell (right-click > Run as Administrator) and run:
    Enable-PSRemoting -Force
    
    This sets up the WinRM service, creates firewall rules, and configures basic listeners.
  2. Verify the WinRM listener is active and configured:
    winrm enumerate winrm/config/listener
    
    You should see a listener bound to your VM's IP address (or * for all addresses) using HTTP (or HTTPS if you set it up).
  3. Adjust security settings to play nice with Windows Server 2008's older auth protocols:
    # Enable NTLM authentication (Server 2008 often relies on this)
    winrm set winrm/config/service/auth @{NTLM="true"}
    # Allow unencrypted traffic (only do this in a trusted test environment; use HTTPS for production)
    winrm set winrm/config/service @{AllowUnencrypted="true"}
    
  4. Double-check the Windows Firewall: Ensure the "Windows Remote Management (HTTP-In)" rule is enabled for the network profile your VM uses (Domain, Private, or Public—whichever applies to your test setup).

On the Windows Server 2008 Jenkins Machine:

  1. Update WinRM to the latest compatible version for Server 2008—older versions can have compatibility issues with Win10.
  2. Add your Win10 VM to the trusted hosts list to bypass certificate validation (safe for testing):
    winrm set winrm/config/client @{TrustedHosts="your-win10-vm-ip"}
    
  3. Make sure the Jenkins service account has the right permissions:
    • The account should be a local administrator on the Win10 VM, or you can add it to the Remote Management Users group on Win10 via:
      # Run this on the Win10 VM
      net localgroup "Remote Management Users" "jenkins-service-account-name" /add
      

Step 3: Integrate WinRM with JSystem

Since JSystem doesn't natively support WinRM, you'll need to bridge the gap. Here are two practical approaches:

  • Wrap WinRM commands in JSystem test steps: Create a JSystem test that executes WinRM/PowerShell commands via the Jenkins agent. For example, to run a test on the Win10 VM, use a PowerShell step like this:
    Invoke-Command -ComputerName your-win10-vm-ip -Credential (Get-Credential) -ScriptBlock {
        # Replace with your actual JSystem test command
        C:\JSystem\bin\test-runner.bat your-test-suite.xml
    }
    
    You can hardcode credentials (not ideal) or use Jenkins' credential store to pass them securely.
  • Build a custom WinRM adapter: If you need deeper integration with JSystem's framework, write a Java class using a WinRM client library (like jWinRM) to handle communication, then plug it into JSystem's test components. This is more work but gives you full control.

Step 4: Fix Common WinRM Errors

Once you have specific error messages from your manual test, here are quick fixes for the most common issues:

  • "Access is denied": Confirm the user account has admin rights on Win10, NTLM auth is enabled (per Step 2), and the account is in the Remote Management Users group.
  • "The client cannot connect to the destination specified in the request": Check that the WinRM service is running on Win10, firewall rules are open, and the Win10 VM's IP is added to Server 2008's TrustedHosts.
  • "Negotiate authentication failed": Enable NTLM authentication on the Win10 VM's WinRM service (the command from Step 2 does this).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:38:35