# Issue with ansible playbook for windows

**URL:** <https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 5, 2019, 2:53pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599 "2019-11-05T14:53:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayan\_Anirudhan](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@Jayan\_Anirudhan](https://forum.ansible.com/u/Jayan_Anirudhan)\
**Post date:** [November 5, 2019, 2:53pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599/1 "2019-11-05T14:53:42Z")

</div>

Hi All,

I have created a playbook to execute a VBScript on windows server and its showing error while performing the syntax check. Kindly have a look and please help me in this regard.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 5, 2019, 3:24pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599/2 "2019-11-05T15:24:46Z")

</div>

Your spacing is all messed up. Try this (I have not used these modules so there may be additional issues):

---

<div class="post-metadata">

**Author:** ![Jayan\_Anirudhan](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@Jayan\_Anirudhan](https://forum.ansible.com/u/Jayan_Anirudhan)\
**Post date:** [November 5, 2019, 4:38pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599/3 "2019-11-05T16:38:47Z")

</div>

Hi Dick,

Thanks for your mail.

As per your mail I have tried the same and found the issue persist. Kindly find the details mentioned below.

[root@Y1972-206 jaywin]# cat win5.yml

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 5, 2019, 4:52pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599/4 "2019-11-05T16:52:00Z")

</div>

> Hi Dick,
> 
> Thanks for your mail.
> 
> As per your mail I have tried the same and found the issue persist. Kindly find the details mentioned below.

Actually the original error is fixed, but now a new one arised.

> ## [root@Y1972-206 jaywin]# cat win5.yml
> 
> - name: Copy PsExec  
> win\_copy:  
> src: /home/testuser/jaytest/g-prediscover.vbe  
> dest: C:\temp  
> force: no
> 
> - name: Run powershell as a specific domain user  
> win\_command: C:\Windows\SysWOW64\cscript.exe g-prediscover.vbe -n 2 +2  
> executable: C:\temp\g-prediscover.vbe  
> elevated: yes  
> nobanner: yes  
> interactive: yes  
> [root@Y1972-206 jaywin]# ansible-playbook -i inventory --syntax-check win5.yml  
> ERROR! Syntax Error while loading YAML.  
> mapping values are not allowed in this context
> 
> The error appears to be in ‘/opt/jaywin/win5.yml’: line 10, column 15, but may  
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> win\_command: C:\Windows\SysWOW64\cscript.exe g-prediscover.vbe -n 2 +2  
> executable: C:\temp\g-prediscover.vbe  
> ^ here

Again, I have no experience whatsoever with the windows modules, but from the docs alone one can see that the win\_command module does not have any of the parameters that you use:

[https://docs.ansible.com/ansible/latest/modules/win\_command\_module.html](https://docs.ansible.com/ansible/latest/modules/win_command_module.html)

Browsing through the windows module list, I think you mixed things up and want to use the win\_psexec module?  
Because that does have all the parameters you use:

[https://docs.ansible.com/ansible/latest/modules/win\_psexec\_module.html](https://docs.ansible.com/ansible/latest/modules/win_psexec_module.html)

I noticed that this needs a ‘command’ parameters.  
Adding the bits of the puzzle:

---

<div class="post-metadata">

**Author:** ![Jayan\_Anirudhan](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@Jayan\_Anirudhan](https://forum.ansible.com/u/Jayan_Anirudhan)\
**Post date:** [November 5, 2019, 6:22pm UTC](https://forum.ansible.com/t/issue-with-ansible-playbook-for-windows/31599/5 "2019-11-05T18:22:24Z")

</div>

Hi Dick,

No luck so far

[root@Y1972-206 jaywin]# cat win6.yml
