# Executing powershell script via ansible playbook is not working properly

**URL:** <https://forum.ansible.com/t/executing-powershell-script-via-ansible-playbook-is-not-working-properly/35502>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [July 13, 2021, 5:31pm UTC](https://forum.ansible.com/t/executing-powershell-script-via-ansible-playbook-is-not-working-properly/35502 "2021-07-13T17:31:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepan\_M](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Deepan\_M](https://forum.ansible.com/u/Deepan_M)\
**Post date:** [July 13, 2021, 5:31pm UTC](https://forum.ansible.com/t/executing-powershell-script-via-ansible-playbook-is-not-working-properly/35502/1 "2021-07-13T17:31:10Z")

</div>

Hi,

I’m trying to execute powershell script via ansible, however playbook is successfully running but its incomplete. same script if I run directely on windows server its perfectly working, its failing whenever i ran through ansible playbook.

Please find below details of playbook, inventory, ansible debug, error.

Kindly review my request and suggest me a solution for this problem.

---

<div class="post-metadata">

**Author:** ![rolandm](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rolandm/32/755_2.png) [@rolandm](https://forum.ansible.com/u/rolandm)\
**Post date:** [July 16, 2021, 3:59am UTC](https://forum.ansible.com/t/executing-powershell-script-via-ansible-playbook-is-not-working-properly/35502/2 "2021-07-16T03:59:48Z")

</div>

Hello,

_when: “‘ECode\*\*==\*\*0’ in Invoke\_PreCC\_out.stdout\_lines”_

here you should use ‘==’ since single ‘=’ is an assignment in Ansible.

BR,  
Roland
