# Not able to connect to windows machine using Ansible.

**URL:** <https://forum.ansible.com/t/not-able-to-connect-to-windows-machine-using-ansible/24350>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 28, 2017, 10:37am UTC](https://forum.ansible.com/t/not-able-to-connect-to-windows-machine-using-ansible/24350 "2017-04-28T10:37:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag\_Tripathi](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@Anurag\_Tripathi](https://forum.ansible.com/u/Anurag_Tripathi)\
**Post date:** [April 28, 2017, 10:37am UTC](https://forum.ansible.com/t/not-able-to-connect-to-windows-machine-using-ansible/24350/1 "2017-04-28T10:37:20Z")

</div>

I am new to Ansible and trying to connect to windows machine using Ansible. I am getting following error:

`

[cic-svr-reiis02.corp.exlservice.com](http://cic-svr-reiis02.corp.exlservice.com) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “plaintext: HTTPConnectionPool(host=‘[cic-svr-reiis02.corp.exlservice.com](http://cic-svr-reiis02.corp.exlservice.com)’, port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘\<requests.packages.urllib3.connection.HTTPConnection object at 0x3d76050\>: Failed to establish a new connection: [Errno 111] Connection refused’,))”,  
“unreachable”: true  
}

`

I have made changes in these three files.

1. Inventory:

`[windows] xxx.xxx.xxx.com`  
1.

1. Krb5.conf

`[realms] XXX.XXX.COM = { kdc = xxx.xxx.xxx.com admin_server = xxx.xxx.xxx.com } [domain_realm] .xxx.xxx.com = XXX.XXX.COM`  
1.

1. group\_vars/windows.yml

I am new to this and may have made mistake in the process of connectivity. Any help would be appreciated. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 2, 2017, 9:52pm UTC](https://forum.ansible.com/t/not-able-to-connect-to-windows-machine-using-ansible/24350/2 "2017-05-02T21:52:50Z")

</div>

From the error message it seems like the WinRM endpoint is not enabled on the remote server hence the Failed to establish a new connection error. Try and use this script to set up the WinRM endpoint on your server [https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1](https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1).

Once you have done that you should have the following entries in your inventory/group\_vars

ansible\_user: user@DOMAIN  
ansible\_password: password  
ansible\_port: 5986  
ansible\_connection: winrm  
ansible\_winrm\_cert\_validation: ignore
