# Ansible unable to ping to windows host  error Failed command was: PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand

**URL:** <https://forum.ansible.com/t/ansible-unable-to-ping-to-windows-host-error-failed-command-was-powershell-noprofile-noninteractive-executionpolicy-unrestricted-encodedcommand/22786>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [October 13, 2016, 2:02pm UTC](https://forum.ansible.com/t/ansible-unable-to-ping-to-windows-host-error-failed-command-was-powershell-noprofile-noninteractive-executionpolicy-unrestricted-encodedcommand/22786 "2016-10-13T14:02:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnabsc74](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnabsc74](https://forum.ansible.com/u/arnabsc74)\
**Post date:** [October 13, 2016, 2:02pm UTC](https://forum.ansible.com/t/ansible-unable-to-ping-to-windows-host-error-failed-command-was-powershell-noprofile-noninteractive-executionpolicy-unrestricted-encodedcommand/22786/1 "2016-10-13T14:02:33Z")

</div>

Hi

When run this ansible command " ansible windows -m win\_ping" I am getting the below error , please can anyone help to fix this issue

10.51.239.192 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAoAE4AZQB3AC0ASQB0AGUAbQAgAC0AVAB5AHAAZQAgAEQAaQByAGUAYwB0AG8AcgB5ACAALQBQAGEAdABoACAAJABlAG4AdgA6AHQAZQBtAHAAIAAtAE4AYQBtAGUAIAAiAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAA3ADYAMwA2ADYANgAwADEALgA1ADgALQAyADAANwA1ADgANgA1ADMANAA4ADQANgA3ADEAMgAiACkALgBGAHUAbABsAE4AYQBtAGUAIAB8ACAAVwByAGkAdABlAC0ASABvAHMAdAAgAC0AUwBlAHAAYQByAGEAdABvAHIAIAAnACcAOwA=, exited with result 1”,  
“unreachable”: true  
}

I am trying to connect to windows (windows 2012 R2) host ip 10.51.239.192

I have created a windows.yml under /etc/ansible/group\_vars , below is the connect of the yml file , in my inventory file I have added the ip of this windows host 10.51.239.192

ansible\_user: Administrator  
ansible\_password: [P@ssw0rd](mailto:P@ssw0rd)  
ansible\_port: 5986  
ansible\_connection: winrm

# The following is necessary for Python 2.7.9+ when using default WinRM self-signed certificates:

ansible\_winrm\_server\_cert\_validation: ignore  
#ansible\_winrm\_transport: ssl

using this same setting I am able to ping to another windows machine which is also windows server 2012

Thanks  
Arnab Chowdhury

---

<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:** [October 13, 2016, 3:53pm UTC](https://forum.ansible.com/t/ansible-unable-to-ping-to-windows-host-error-failed-command-was-powershell-noprofile-noninteractive-executionpolicy-unrestricted-encodedcommand/22786/2 "2016-10-13T15:53:03Z")

</div>

Usually when I’ve seen that error, it’s because Powershell is not on the system path (ie, C:\Windows\System32\WindowsPowerShell\v1.0). Unfortunately the error message comes from a much higher level (a failure creating the tempdir), so the error message isn’t specific to failures that might occur on Windows (hence the somewhat misleading text).
