# win\_shell cmd parsing domain\\usernmame issue

**URL:** <https://forum.ansible.com/t/win-shell-cmd-parsing-domain-usernmame-issue/37973>\
**Category:** Ansible Project\
**Created:** [May 10, 2023, 6:44am UTC](https://forum.ansible.com/t/win-shell-cmd-parsing-domain-usernmame-issue/37973 "2023-05-10T06:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Veliss](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@John\_Veliss](https://forum.ansible.com/u/John_Veliss)\
**Post date:** [May 10, 2023, 6:44am UTC](https://forum.ansible.com/t/win-shell-cmd-parsing-domain-usernmame-issue/37973/1 "2023-05-10T06:44:10Z")

</div>

Hello,

I am trying to use the win\_shell module to run a script which includes the username parameter.

- name: Execute {{ set\_wmi}} to capture the existing user accounts for WMI security for the root namespace  
win\_shell: .\set-WmiNamespaceSecurity.ps1 root add “domain\username\_sls” Enable,RemoteAccess,Methodexecute  
args:  
chdir: “{{ temp }}”  
register: set\_wminamespace

The result always seems to be “account not found”. I am not sure if it is trying to always pass the \ as part of the username.

If anyone can help or advise here, that would be much appreciated as I think I have tried username@domain, also I have tried to use variables instead of the actual account. Tried single and double quotes, everything results in account not found.

TASK [Execute Set-WmiNamespaceSecurity.ps1 to capture the existing user accounts for WMI security for the root namespace] \*\*\*  
Wednesday 10 May 2023 06:06:09 +0000 (0:00:00.062) 0:00:46.653 \*\*\*\*\*\*\*\*\*  
fatal: [xxyzwappf0013.domain]: FAILED! =\> {“changed”: true, “cmd”: “.\\set-WmiNamespaceSecurity.ps1 root add \“domain\\username\_sls\” Enable,RemoteAccess,Methodexecute”, “delta”: “0:00:01.203183”, “end”: “2023-05-10 06:06:13.528524”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2023-05-10 06:06:12.325341”, “stderr”: “Account was not found: domain\\username\_sls\r\nAt C:\\temp\\wmi\\Set-WmiNamespaceSecurity.ps1:138 char:9\r\n+ throw \“Account was not found: $account\”\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OperationStopped: (Account was not…username \r\n \_sls:String) , RuntimeException\r\n + FullyQualifiedErrorId : Account was not found: domain\\username\_sls”, “stderr\_lines”: [“Account was not found: domain\\username\_sls”, “At C:\\temp\\wmi\\Set-WmiNamespaceSecurity.ps1:138 char:9”, “+ throw \“Account was not found: $account\””, “+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”, " + CategoryInfo : OperationStopped: (Account was not…username “, " \_sls:String) , RuntimeException”, " + FullyQualifiedErrorId : Account was not found: domain\\username\_sls"], “stdout”: “”, “stdout\_lines”: }  
…ignoring

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [May 12, 2023, 3:51pm UTC](https://forum.ansible.com/t/win-shell-cmd-parsing-domain-usernmame-issue/37973/2 "2023-05-12T15:51:24Z")

</div>

I have never done WMI through Ansible. My role does not require it of me. That said, it looks like you are running a script already installed on the target box. If that’s correct, can you output the exact value of the $account variable? I believe that would tell you what your input variable needs to look like.

Kevin
