# establishing winrm connection failing

**URL:** <https://forum.ansible.com/t/establishing-winrm-connection-failing/20984>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 24, 2016, 7:01pm UTC](https://forum.ansible.com/t/establishing-winrm-connection-failing/20984 "2016-03-24T19:01:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giggs11](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@giggs11](https://forum.ansible.com/u/giggs11)\
**Post date:** [March 24, 2016, 7:01pm UTC](https://forum.ansible.com/t/establishing-winrm-connection-failing/20984/1 "2016-03-24T19:01:19Z")

</div>

I have a CentOS 7.2 server with Ansible 1.9.4 running. I’m trying to ping or get info from windows servers following the documentation here: [http://docs.ansible.com/ansible/intro\_windows.html](http://docs.ansible.com/ansible/intro_windows.html)  
I’ve added a windows host to the hosts file under windows. Ran the ps1 script to enable remoting etc. I created a group\_vars directory in there and a windows.yml file and set it up as described in the document.

I’m trying to run a _ansible windows -m setup -vvvv_ and see the following

\<10.69.28.100\> ESTABLISH WINRM CONNECTION FOR USER: root on PORT 5986 TO x.x.x.x  
\<10.69.28.100\> WINRM CONNECT: transport=plaintext endpoint=[https://x.x.x.x:5986/wsman](https://x.x.x.x:5986/wsman)  
\<10.69.28.100\> WINRM CONNECTION ERROR: 401 Unauthorized.

It appears like none of the inventory variables in group\_vars/windows.yml are being read except for ansible\_connection: winrm  
If i change the port , there is no change in the error message. Same for username and password. I’m not sure why this is happening . Any input will be appreciated.

Other notes:

Kerberos appears to work. I can klist etc.  
The centos server is joined to the domain  
I don’t see anything in the windows server event logs and confirm that the account information is correct

---

<div class="post-metadata">

**Author:** ![giggs11](https://avatars.discourse-cdn.com/v4/letter/g/919ad9/32.png) [@giggs11](https://forum.ansible.com/u/giggs11)\
**Post date:** [March 25, 2016, 3:47pm UTC](https://forum.ansible.com/t/establishing-winrm-connection-failing/20984/2 "2016-03-25T15:47:01Z")

</div>

For anyone looking into this:

i had to use the old instance variables:

ansible\_ssh\_username  
ansible\_ssh\_pass

to make this work. I’m not sure which version or above i need for the variables explained in the document to work? 2.0 \> ?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 26, 2016, 5:19pm UTC](https://forum.ansible.com/t/establishing-winrm-connection-failing/20984/3 "2016-03-26T17:19:43Z")

</div>

Yes, the new names came in with Ansible 2.0.

If you can, I would recommend using 2.0.0.2 or later if you are working with Windows - it's noticeably faster. Oh and check you are using pywinrm \>= 0.11 as that speeds it up too.

HTH,

Jon
