How to fix "The WS-Management service cannot process the request because the selector values do not match a known resource, or the resource is offline."
The error "The WS-Management service cannot process the request because the selector values do not match a known resource, or the resource is offline" usually occurs when a Windows Remote Management (WinRM) connection fails. This happens because the client is trying to communicate with a remote resource using an incorrect identifier (selector), or the WinRM service on the target machine is stopped, misconfigured, or blocked by a firewall.
How to Fix It (Step-by-Step)
Follow these steps in order to resolve the issue. You will need administrative privileges on both the local and remote computers.
Step 1: Verify and Start the WinRM Service
The most common cause is that the WinRM service is not running on the destination machine.
- Open the Start Menu on the target (remote) computer.
- Type
cmd, right-click Command Prompt, and select Run as administrator. - Type the following command and press Enter:
winrm quickconfig - If prompted to make changes or start the service, type
y(Yes) and press Enter. This command starts the WinRM service and sets its startup type to Automatic.
Step 2: Check the Endpoint URL and Selector Values
If you are using PowerShell Remoting (like Invoke-Command or Enter-PSSession), ensure you are not passing an invalid or mismatched resource URI.
- If you are targeting a specific workflow or custom shell, verify your
-ConfigurationNameparameter in PowerShell. - If you are using a specific URI, verify that the spelling of your resource precisely matches the configuration defined on the server.
- For standard remote management, use the default connection without specifying custom selectors:
Enter-PSSession -ComputerName "RemoteComputerName"
Step 3: Enable Remote Management via Group Policy (If applicable)
In domain environments, group policies might block the resource endpoints.
- On the remote machine, press
Windows Key + R, typegpedit.msc, and press Enter. - Navigate to: Computer Configuration > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service.
- Double-click Allow remote server management through WinRM.
- Set it to Enabled, and define the IPv4 and IPv6 filters as
*(or specific IP ranges to allow). - Click Apply and then OK.
- Open Command Prompt as Administrator and run
gpupdate /forceto apply changes immediately.
Step 4: Add the Target to TrustedHosts (For Workgroups)
If the computers are not in the same Active Directory domain, the client machine will reject the connection unless the server is trusted.
- On your local (client) computer, open PowerShell as an Administrator.
- Run the following command to trust the remote computer (replace
RemoteComputerNamewith the actual IP address or hostname):Set-Item WSMan:\localhost\Client\TrustedHosts -Value "RemoteComputerName" -Force - Restart the WinRM service on your local machine to apply changes:
Restart-Service winrm
Step 5: Check Windows Firewall Ports
The firewall might be blocking the network traffic needed to reach the resource endpoint.
- On the remote computer, open PowerShell as an Administrator.
- Run these commands to ensure ports 5985 (HTTP) and 5986 (HTTPS) are open:
Enable-NetFirewallRule -DisplayGroup "Windows Remote Management"
ERROR_WSMAN_INVALID_SELECTOR_NAME | ERROR_WSMAN_ENCODING_TYPE | ERROR_WSMAN_INVALID_HEADER | ERROR_WSMAN_ENUMERATE_UNSUPPORTED_EXPIRATION_TYPE | ERROR_WSMAN_MAX_ELEMENTS_NOT_SUPPORTED
There may be some errors. Learn Microsoft