# winrm send\_input failed. help needed.

**URL:** <https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703>\
**Category:** Ansible Developer\
**Created:** [July 3, 2019, 9:24am UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703 "2019-07-03T09:24:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Jackson](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@Chris\_Jackson](https://forum.ansible.com/u/Chris_Jackson)\
**Post date:** [July 3, 2019, 9:24am UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/1 "2019-07-03T09:24:10Z")

</div>

Hello,

My playbook is failing with a long error:

winrm send\_input failed; \nstdout: Unable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\nUnable to initialize device PRN\r\n\nstderr \_ANSIBALLZ\_WRAPPER : The term ‘\_ANSIBALLZ\_WRAPPER’ is not recognized as the name of a cmdlet, function, script file, \r\nor operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and \r\ntry again.\r\nAt line:1 char:1\r\n+ \_ANSIBALLZ\_WRAPPER = True # For test-module script to tell this is a …\r\n+ ~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (_ANSIBALLZ\_WRAPPER:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nAt line:1 char:21\r\n+ def ansiballz\_main():\r\n+ ~\r\nAn expression was expected after ‘(’.\r\n + CategoryInfo : ParserError: (🙂 [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : ExpectedExpression\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, function, script file, or operable program. \r\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import os\r\n+~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, function, script file, or operable program. \r\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import os.path\r\n+ ~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, function, script file, or operable program. \r\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import sys\r\n+~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nimport : The term ‘import’ is not recognized as the name of a cmdlet, function, script file, or operable program. \r\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ import **main** \r\n+ ~~~~~~\r\n + CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nscriptdir : The term ‘scriptdir’ is not recognized as the name of a cmdlet, function, script file, or operable \r\nprogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ scriptdir = None\r\n+~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: (scriptdir:String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\ntry: : The term ‘try:’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check \r\nthe spelling of the name, or if a path was included, verify that the path is correct and try again.\r\nAt line:1 char:5\r\n+ try:\r\n+ ~~~~\r\n + CategoryInfo : ObjectNotFound: (try::String) [], CommandNotFoundException\r\n + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\n\_\_main_. **file** : The term ‘ **main**. **file** ’ is not recognized as the name of a cmdlet, function, script file, or \r\noperable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try \r\nagain.\r\nAt line:1 char:54\r\n+ … scriptdir = os.path.dirname(os.path.realpath( **main**. **file** ))\r\n+~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : ObjectNotFound: ( **main**. **file** :String)

I understand from a previous post that this may have something to do with Ansible expecting a python script but getting a powershell script instead. I am executing a role which is as follows:-

- name: Ensure that the temporary unpacking area is there  
file:  
path: “{{ package\_install\_home }}”  
state: directory  
recurse: yes

- name: Get the package from the artifactory and install it  
include\_tasks: Windows\_Get\_And\_Install\_MSI.yml  
with\_items: “{{ lookup(‘dict’, artifacts) }}”

- name: Copy the powershell script to the remote system  
win\_copy:  
src: files/ModifyPath.ps1  
dest: “{{ package\_install\_home }}”

- name: Modify the system path so that perl.exe is visible  
win\_command: “powershell.exe {{ package\_install\_home }}\ModifyPath.ps1”

Can anyone help?

Kind Regards

Chris.

---

<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:** [July 3, 2019, 11:02am UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/2 "2019-07-03T11:02:40Z")

</div>

You can’t use Python modules on a Windows host, use win\_file and not file.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Chris\_Jackson](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@Chris\_Jackson](https://forum.ansible.com/u/Chris_Jackson)\
**Post date:** [July 3, 2019, 12:58pm UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/3 "2019-07-03T12:58:48Z")

</div>

Thanks Jordan,

The playbook has now moved on and now i am getting the following error:-

‘ansible.utils.unsafe\_proxy.AnsibleUnsafeText object’ has no attribute ‘name’

this is being generated from an include\_tasks on the following YAML:

name: Get the package from the artifactory  
win\_uri:  
url: “{{ artifactory\_path }}/{{ this\_artifact.name }}/{{ this\_artifact.version }}/{{ this\_artifact.package }}”  
method: GET  
headers:  
X-JFrog-Art-Api: “{{ artifactory\_api\_key }}”  
dest: “{{ package\_install\_home }}”

- name: Install the .msi package  
win\_package:  
path: “{{ package\_install\_home }}\{{ this\_artifact.package }}”  
arguments: “/i /qb TARGETDIR=d:\perl INSTALLDIR=d:\strawberry\perl”  
state: present

Any ideas?

Chris

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [July 3, 2019, 6:24pm UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/4 "2019-07-03T18:24:11Z")

</div>

Can you use the debug module and print out [the variable this\_artifact.name ?](http://this_artifact.name)

It appears you have registered this\_artifact in previous tasks but I suspect it doesn’t have name attribute after this\_artifact. You might have to use this\_artifact.stdout.name or something like that.

Tony

---

<div class="post-metadata">

**Author:** ![Chris\_Jackson](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@Chris\_Jackson](https://forum.ansible.com/u/Chris_Jackson)\
**Post date:** [July 4, 2019, 9:18am UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/5 "2019-07-04T09:18:43Z")

</div>

Thanks Tony,

Yes, you were right - I needed {{ this\_artifact.value.name }}

Chris.

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [July 4, 2019, 6:17pm UTC](https://forum.ansible.com/t/winrm-send-input-failed-help-needed/30703/6 "2019-07-04T18:17:08Z")

</div>

Btw you can use ARA to display the output of each registered variables without using the debug module

Another side benefits is that it keeps your execution logs so you can refers to it later

[https://ara.readthedocs.io/en/latest/](https://ara.readthedocs.io/en/latest/)
