# NEED HELP - connecting via winrm

**URL:** <https://forum.ansible.com/t/need-help-connecting-via-winrm/21660>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 3, 2016, 2:39pm UTC](https://forum.ansible.com/t/need-help-connecting-via-winrm/21660 "2016-06-03T14:39:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaron.trujillo](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@aaron.trujillo](https://forum.ansible.com/u/aaron.trujillo)\
**Post date:** [June 3, 2016, 2:39pm UTC](https://forum.ansible.com/t/need-help-connecting-via-winrm/21660/1 "2016-06-03T14:39:16Z")

</div>

I am having trouble connecting to a windows vm via the ansible winrm connection.  
I am using ansible 2.0.2

host settings

[Windows]  
[GP1-LAB-OPSTST2.com](http://GP1-LAB-OPSTST2.com)  
[192.168.30.101.com](http://192.168.30.101.com)

[Windows\_var]  
ansible\_ssh\_user=  
ansible\_ssh\_pass=  
ansible\_ssh\_port=5985  
ansible\_connection=winrm

ansible returns

root@GP1-LAB-OPSTST1:/etc/ansible# ansible Windows -m win\_ping  
[192.168.30.101.com](http://192.168.30.101.com) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh.”,  
“unreachable”: true  
}  
[GP1-LAB-OPSTST2.com](http://GP1-LAB-OPSTST2.com) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh.”,  
“unreachable”: true

Windows machine

address = \*  
transport = http  
port = 5985  
hostname  
enabled = true  
urlprefix = wsman  
certificate thumbprint  
listening on = 127.0.0.1, 192.168.30.101, ::1

Any clues as to what to do next?

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [June 3, 2016, 3:39pm UTC](https://forum.ansible.com/t/need-help-connecting-via-winrm/21660/2 "2016-06-03T15:39:59Z")

</div>

The var definition in your inventory file is wrong- try:

[Windows:vars]

Also, if you’re on 2.x you should probably use the new ansible\_user/ansible\_port/ansible\_password vars. The old ansible\_ssh\_X versions will continue to work, but the new ones are much clearer.
