Windows Remote Management or WinRM is a management protocol, based on Simple Object Access Protocol (SOAP) that is used for interoperability between different hardware and operating systems. It can be used for writing scripts to automate the management of servers.
Sometimes, while establishing a connection with the remote server, you get an error similar to the below.
Connecting to remote server exchange.contoso.com failed with the following error message: WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed
As indicated from the error message, there might be different reasons for this error. Let us understand the reasons behind this error and see how to resolve it.
Reasons for WinRM cannot Complete the Operation Error
This error can occur due to one or more of the following reasons:
- The Firewall or security settings on the remote computer may be blocking WinRM traffic.
- The WinRM service may not be running on the remote computer.
- Using wrong username or password to connect to the remote computer.
- Configuration issues preventing from establishing a connection with the server.
Methods to Resolve the Error WinRM cannot Complete the Operation
Here are the methods to resolve the WinRM cannot complete the operation error.
Method 1: Check if All the Services are Running
If you are using the Exchange Management Shell (EMS) remotely, try launching it directly from the server. This will help determine if the issue is with remote connectivity or the server itself.
If the management shell is still not working, it is best to check that all the services are running. If any service is not running, then right click on the service and select Start.
Now, check if WinRM is running. This can be done by running the following command via Command Prompt or PowerShell with administrative privileges.
WinRM quickconfig
If WinRM is running, it means everything is working fine. You can relaunch the Exchange Management Shell (EMS) and see if you can connect without any issues.
Method 2: Track the Changes on the Server or System
To identify the reason behind the issue, you can try to trace back what changed from when the WinRM was working to when it stopped working. You can keep a log of all the changes performed on the server. Here is how you can do it:
- Maintain a Change Log: Keep a detailed log of all changes made to the server, including dates and descriptions.
- Review Recent Changes: Compare the server's state from when WinRM was working to when it stopped. Identify any changes that were made during that period. If the issue has occurred after doing some specific changes, then try to roll back the changes.
- Check for Specific Updates: Look for recent updates or cumulative updates (CUs) that might have been installed and check if these updates may have had any effect on the WinRM traffic.
- Third-Party Applications: Some third-party applications, like antivirus, may affect the WinRM traffic and cause the error. Check the settings of these applications and see if the exception for WinRM service is enabled.
Some Additional Solutions to Resolve the Error
You can also try the below-mentioned solutions to resolve the WinRM cannot complete the operation error:
- Check and Assign the required Permissions: The user account that you are using to access the remote server should have the following roles and permissions:
- Membership of the Remote Management Users role group on the remote Exchange Server.
- Allow Delegated Administration permission on the remote computer.
If these roles and permissions are not assigned to your user account, then assign them.
- Check the Firewall Settings: You may encounter this error if the firewall on the remote server blocks the WinRM traffic. So, you can check the firewall settings and see if the exception for WinRM service is enabled. For this, open the Windows Firewall with Advanced Security control panel. In the Inbound Rules tab, look for a rule named Windows Remote Management (WinRM). If the rule is not enabled, enable it.
- Check the Network Connectivity. The error may also occur if there is a problem with the network connection between the two servers. To check the connectivity, try pinging the remote server from the local server. If you cannot ping the remote server, it indicates a problem with the network connection.
Wrapping Up
Above, we have mentioned some possible solutions to fix the WinRM cannot complete the operation error. Now, if the problem persists, it would mean that there might be corruption in the installation of Exchange Server. In such a case, you need to reinstall the affected Exchange Server and recover the mailboxes. For this, it would be best to rely on a third-party Exchange recovery tool that can simplify the operation. One such tool is Stellar Repair for Exchange that can do the job efficiently and with no extra efforts and resources. The tool can open any version of the Exchange Server database - from 2007 to 2019. It can also open corrupted databases with the Dirty Shutdown state. You don’t need an Exchange Server to open and browse through your database. You can use this tool to granularly export the recovered mailboxes to PST and other formats.
Stellar Repair for Exchange also allows you to export directly to a live Exchange Server of any version and an Office 365 tenant. It offers several features, like parallel export, priority (VIP) exports, and continuation in case the process is interrupted. This ensures smooth recovery and the business will have the services running in no time.