Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap windows winrm fails with network error

I am trying to bootstrap a windows winrm using knife command.

I have enabled the tcp port 5985. But i still get the following error:

ERROR: Network Error: Connection refused - connect(2) (http://:5985)

I am able to remotely login to the machine as well by providing username and password

I could not resolve. Has anyone come across this problem and found a solution?

like image 423
user1907849 Avatar asked Feb 14 '23 00:02

user1907849


1 Answers

Check that you can telnet remote_host 5985. This should open a dumb session into which you can enter "quit". If not, look again at how you have enabled winrm and the firewall on the remote host.

I got winrm bootstrap working on Windows VMs which did not have firewall enabled like this:

All the following on the remote Windows machine you want to bootstrap...

Enable winrm:

winrm quickconfig -q

Enable and start the firewall service (so we can successfully config winrm):

sc config mpssvc start= demand
sc start mpssvc

Configure winrm per chef recommendations:

winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
winrm set winrm/config @{MaxTimeoutms="1800000"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/service/auth @{Basic="true"}

Stop the firewall service again:

sc stop mpssvc

... or configure it to allow to winrm connections from the workstation.

Now, on your workstation, validate the set up:

Validate that remote host is listening on default winrm port

telnet remote_host 5985

(If connection is successful, a blank telnet session will open. You can enter "quit" to exit it.)

Optionally validate that knife winrm can connect to the remote host (e.g. to list the c:\ directory)

knife winrm -m remote_host -x remote_user -P remote_password 'dir c:\'

Bootstrap the node

knife bootstrap windows winrm remote_host -x remote_user -P remote_password

Since you ask for an answer drawing from credible and/or official sources here are the references I found useful when figuring out how to get winrm bootstrap to work:

  • http://docs.opscode.com/install_windows.html
  • http://docs.opscode.com/plugin_knife_windows.html
  • http://developer.rackspace.com/blog/step-by-step-walkthrough-to-using-chef-to-bootstrap-windows-nodes-on-the-rackspace-cloud.html
like image 105
sudocode Avatar answered Feb 27 '23 15:02

sudocode