# variable passing in win\_shell module with powershell command

**URL:** <https://forum.ansible.com/t/variable-passing-in-win-shell-module-with-powershell-command/34178>\
**Category:** AWX Project\
**Tags:** windows\
**Created:** [November 11, 2020, 4:54am UTC](https://forum.ansible.com/t/variable-passing-in-win-shell-module-with-powershell-command/34178 "2020-11-11T04:54:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kundan\_Singh](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@Kundan\_Singh](https://forum.ansible.com/u/Kundan_Singh)\
**Post date:** [November 11, 2020, 4:54am UTC](https://forum.ansible.com/t/variable-passing-in-win-shell-module-with-powershell-command/34178/1 "2020-11-11T04:54:25Z")

</div>

Hi All,

I am using win\_shell module in playbook to execute a PowerShell script.  
while execution of script it will prompt and ask for a domain and username  
below is the synatx i am using need help on the variable part declartion.

- name: Executing script on endpoint

ansible.windows.win\_shell: .\winrm\_configuration\_wizardv3.0.ps1 -user {{ domain }}{{ username }} -unencrypted -http\_port 5985 -max\_requests 1000 -silent

args:

chdir: C:\Temp\

become\_method: runas

become\_user: Administrator

Regards  
Kundan SIngh

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [November 11, 2020, 6:53am UTC](https://forum.ansible.com/t/variable-passing-in-win-shell-module-with-powershell-command/34178/2 "2020-11-11T06:53:57Z")

</div>

That will not work. Use custom credentials with variable options to achieve what you are after

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [November 11, 2020, 8:33pm UTC](https://forum.ansible.com/t/variable-passing-in-win-shell-module-with-powershell-command/34178/3 "2020-11-11T20:33:38Z")

</div>

OK I reread this. Where are you having problems? The variables are set correctly? In this case you will just pass in the variables from the job template or where ever you have placed the vars
