Enter-PSSession cmdlet gives following error “CreateRemoteRunspaceFailed” when trying to connect to a remote pc using enter-pssession -computername <pcname>
enter-pssession : Connecting to remote server <pc name> failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ enter-pssession -computername <pc name>
+ CategoryInfo : InvalidArgument: (pc name:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
As its already mentioned in the error message, you need to enable firewall in the destination pc and also you need to make sure WS-Management service is running properly. and also the solution is also pretty straightforward in the error message.
We just need to run “winrm quickconfig” in the destination computer first. This will create necessary firewall rules and it will also take care of running status of WS-Management service.
If you receive “Error. WSManFault. Message = Access is denied. Error number: -21470248910x80070005. Access is denied.”
This means you have not run cmd as administrator.. Run cmd as administrator to avoid error “WSManFault. Message = Access is denied. Error number: -2147024891 0x80070005”.
It’s done.. now try to enter-pssession -computername <pcname> and it works from a remote computer!!