# basic connection to windows with WinRM failing, need a clue.

**URL:** <https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 16, 2017, 11:03pm UTC](https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052 "2017-11-16T23:03:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackson\_Pollock](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jackson\_Pollock](https://forum.ansible.com/u/Jackson_Pollock)\
**Post date:** [November 16, 2017, 11:03pm UTC](https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052/1 "2017-11-16T23:03:32Z")

</div>

First time trying to get some windows automation going, I must be missing something. Installed winrm & powershell via the ansible provided scripts from: [http://docs.ansible.com/ansible/latest/intro\_windows.html#windows-system-prep](http://docs.ansible.com/ansible/latest/intro_windows.html#windows-system-prep)

attempting basic auth only, this is ansible 2.5.0 (latest)

this works just fine:  
**curl -vk -d “” -u “tmp:scout” [http://10.80.180.41:5985/wsman](http://10.80.180.41:5985/wsman)**

`

- Trying 10.80.180.41…

- Connected to 10.80.180.41 (10.80.180.41) port 5985 (#0)

- Server auth using Basic with user ‘tmp’

> POST /wsman HTTP/1.1

> Host: 10.80.180.41:5985

> Authorization: Basic dG1wOjRzY291dA==

> User-Agent: curl/7.43.0

> Accept: _/_

> Content-Length: 0

> Content-Type: application/x-www-form-urlencoded

> 

\< HTTP/1.1 401

\< Server: Microsoft-HTTPAPI/2.0

\< WWW-Authenticate: Negotiate

\< Date: Thu, 16 Nov 2017 22:53:09 GMT

\< Connection: close

\< Content-Length: 0

\<

- Closing connection 0Enter code here…

`

Using same everything with ansible:

group\_vars/windows.yml

`ansible_user: tmp ansible_password: scout ansible_ssh_port: 5985 ansible_connection: winrm ansible_winrm_scheme: http ansible_winrm_server_cert_validation: ignore ansible_winrm_transport: plaintext`

This fails:  
**ansible windows -i hosts -m win\_ping**

`

10.80.180.41 | UNREACHABLE! =\> {

“changed”: false,

“msg”: “plaintext: the specified credentials were rejected by the server”,

“unreachable”: true

}

`

Credentials are fine as you can see and I have logged in with them, set as “Administrator”.

Any ideas?

thanks!

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 16, 2017, 11:50pm UTC](https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052/2 "2017-11-16T23:50:52Z")

</div>

Your curl command is returning a 401 Unauthorized. That is not successful.

---

<div class="post-metadata">

**Author:** ![Jackson\_Pollock](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@Jackson\_Pollock](https://forum.ansible.com/u/Jackson_Pollock)\
**Post date:** [November 16, 2017, 11:58pm UTC](https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052/3 "2017-11-16T23:58:24Z")

</div>

Good catch.

The root issue here is http, must be https or the windows trustedhost rules come into play.

I got it to work with https and a self-signed cert.

---

<div class="post-metadata">

**Author:** ![Mike\_Fennemore](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@Mike\_Fennemore](https://forum.ansible.com/u/Mike_Fennemore)\
**Post date:** [November 17, 2017, 9:39am UTC](https://forum.ansible.com/t/basic-connection-to-windows-with-winrm-failing-need-a-clue/26052/4 "2017-11-17T09:39:54Z")

</div>

Is the user you are attempting to connect with a Local admin? if not try winrm configSDDL default then adding the required permissions for the user.
