Remoting in Powershell Worked Earlier. But It Does Not Work Anymore.


I have two computers configured as a home group. Xu_xps works as the local machine, ch-acer as the remote one.

In order to do remoting, I run the following cmdlet on the remote PC.

set-item wsman:\localhost\client\trustedhosts - value xu_xps

Now xu_xps can do remoting with ck-acer. However, when I am away from the PCs for a few hours, then come back to the desk to do remoting cmdlets again, I see an error message: The WinRM client cannot process the request because the server name cannot be resolved.

If I re-run the cmdlet below again, it works again.

set-item wsman:\localhost\client\trustedhosts - value xu_xps

Why so?


Although Windows PowerShell Remoting really acts like a web service and uses stateless connections, the server maintains a heartbeat to the client. If the network connection between client and server is lost for a certain period of time, the server discards the session. This is controlled by a WSMan setting called IdleTimeout. On my case, both PCs have idletime for 7200000 miniseconds or 2 hours.
Dir WSMan:\localhost\shell\idletimeout