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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7d708ab6-e2a4-456a-af16-2bab178de6e5n%40googlegroups.com.

Reply via email to