Hi
We are using winrm 2.1.1 with Jruby 9.1.1.0. We are executing some basic powershell commands as well as command-line commands in negotiate as transport mode from a remote Ubuntu server(16.04 LTS) to Windows R2 2012 server were winrm is configured.Below is the code snippet which we are using:
require 'winrm'
opts = {
endpoint: 'http://someurl.com:5985/wsman',
transport: :negotiate,
user: 'Administrator',
password: 'mypassword'
}
conn = WinRM::Connection.new(opts)
conn.logger.level = :debug
conn.shell(:powershell) do |shell|
output = shell.run('$PSVersionTable') do |stdout, stderr|
STDOUT.print stdout
STDERR.print stderr
end
puts "The script exited with exit code #{output.exitcode}"
end
When we are executing the above code we are simply getting connection time out while executing the commands (for both powershell and cmd commands). We are not getting any specific error logs, so we are stuck and unable to debug the root cause.
We have also traced the network packets using Wireshark Tool and we are getting following logs -
Case 1 . Failure in executing command via ubuntu server to Windows server
a. 72.251.240.36 -Ubuntu server
b. 10.0.37.104 Windows R2 2012 server where winrm is configured

Case 2 . Success in executing the command via ubuntu server to Windows server
a. 72.251.240.36 -Ubuntu server
b. 10.0.37.104 Windows R2 2012 server where winrm is configured

Please Note: While executing the above code snippet command or any other commands as well , out of 10 times,only 2 times the commands gets executed successfully through the same ubuntu server(72.251.240.36) on the same Windows server(10.0.37.104) .Rest of the time we get a timeout.
Thanks in advance !!
Do let us know if you need any more details.
Hi
We are using winrm 2.1.1 with Jruby 9.1.1.0. We are executing some basic powershell commands as well as command-line commands in negotiate as transport mode from a remote Ubuntu server(16.04 LTS) to Windows R2 2012 server were winrm is configured.Below is the code snippet which we are using:
When we are executing the above code we are simply getting connection time out while executing the commands (for both powershell and cmd commands). We are not getting any specific error logs, so we are stuck and unable to debug the root cause.
We have also traced the network packets using Wireshark Tool and we are getting following logs -
Case 1 . Failure in executing command via ubuntu server to Windows server
a. 72.251.240.36 -Ubuntu server
b. 10.0.37.104 Windows R2 2012 server where winrm is configured
Case 2 . Success in executing the command via ubuntu server to Windows server
a. 72.251.240.36 -Ubuntu server
b. 10.0.37.104 Windows R2 2012 server where winrm is configured
Please Note: While executing the above code snippet command or any other commands as well , out of 10 times,only 2 times the commands gets executed successfully through the same ubuntu server(72.251.240.36) on the same Windows server(10.0.37.104) .Rest of the time we get a timeout.
Thanks in advance !!
Do let us know if you need any more details.