question

MrFlinstone-1451 avatar image
0 Votes"
MrFlinstone-1451 asked

Running remote commands using winrm and timeout

Hi All.


We are calling winrm commands from a remote host (ansible), and the issue we are having is the host being in a stuck state and the batch server is also stuck for hours/days. The root cause of these issues appears to be the bad health of the target server, it could be memory, page file or general health stability. When we have had a similar issue from ansible and the a PS remoting command executed from a Ps shell, I got the error below.


 The request for the Windows Remote Shell with ShellId 0000000-1D4F-4GYY-55BB-D98DFDKJ348J failed because the shell
 was not found on the server. Possible causes are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retry the operation. For more information, see the about_Remote_Troubleshooting Help
 topic.
     + CategoryInfo          : OpenError: (SERVERNAME.domain:String) [], PSRemotingTransportException
     + FullyQualifiedErrorId : CannotConnectTargetSessionDoesNotExist,PSSessionStateBroken 

Is there a way to force a timeout on wrm so that the session can be aborted and exit procedures triggered ?

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers