PowerShell远程终止进程报错:feature is not supported in remote machine
Let’s work through your issue step by step—since PSRemoting is off and your go-to commands stopped working, we’ll focus on reliable alternatives that don’t require it.
First, Diagnose the Root Causes
Your original Stop-Process pipeline failing with "feature is not supported in remote machine" likely stems from recent PowerShell updates: Stop-Process was never designed for explicit remote use, and older implicit support might have been removed. For the Get-WmiObject issue, the Terminate() method might be silently failing due to permission issues or WMI configuration changes on remote machines.
Solution 1: Use Modern CIM Cmdlets (More Reliable Than WMI)
Replace the deprecated Get-WmiObject with Get-CimInstance and Invoke-CimMethod—this is Microsoft’s recommended modern alternative for remote management without PSRemoting. It also returns clear error codes to debug failures:
# Get Chrome processes and terminate them, with result logging $chromeProcesses = Get-CimInstance -ComputerName $comp -ClassName Win32_Process -Filter "Name LIKE '%chrome.exe'" foreach ($proc in $chromeProcesses) { $terminationResult = $proc | Invoke-CimMethod -MethodName Terminate Write-Host "Process ID $($proc.ProcessId) | Termination Status Code: $($terminationResult.ReturnValue)" }
What the Return Codes Mean:
0: Success (process terminated)2: Access denied (your account lacks permissions on the remote machine)5: Permission denied (similar to 2, often related to UAC restrictions)8: Unknown failure9: Path not found
If you see codes 2 or 5, confirm your user account is in the Local Administrators group on the remote machine, and WMI access is allowed for your account.
Solution 2: Use taskkill via PsExec (No WMI Dependencies)
If WMI is acting up, Sysinternals’ PsExec tool lets you run commands remotely without PSRemoting. It relies on SMB (port 445) instead, which is often enabled by default:
# Download PsExec first (from Sysinternals, safe and free) psexec \\$comp taskkill /f /im chrome.exe
/f: Forces termination of stubborn processes (like Chrome’s multi-process instances)/im: Targets processes by image name (chrome.exe)
Critical Checks to Fix "Suddenly Broken" Behavior
Since this worked last week, something changed on your remote machines or network:
- Firewall Rules: Verify remote machines allow inbound WMI traffic (port 135 + dynamic ports 49152-65535) or SMB (port 445) if using PsExec.
- WMI Permissions: On remote machines, open
wmimgmt.msc, right-click WMI Control (Local) → Properties → Security tab. Ensure your user account has Execute Methods, Enable Account, and Remote Enable permissions for theroot\cimv2namespace. - Chrome’s Multi-Process Model: Chrome runs multiple child processes—make sure your command targets all instances (the
LIKE '%chrome.exe'filter should catch them, buttaskkill /f /im chrome.exewill terminate all at once).
内容的提问来源于stack exchange,提问作者raduuu

