Hello,
I am trying to run a PS script using win_shell modules
The name of the script is called Set-WmiNamespaceSecurity-ps1
https://github.com/grbray/PowerShell/blob/main/Windows/Set-WMINameSpaceSecurity.ps1
When I run the command from the command line, it runs fine with no issues.
When I copy the script to a remote host and try to run using ansibles win_shell, I always have errors in regards to “Account was not found”
The syntax of my win_shell command is as below
win_shell: .\Set-WmiNamespaceSecurity.ps1 -namespace root -operation add -account ‘user@domain’ Enable,RemoteAccess,Methodexecute
or
win_shell: .\Set-WmiNamespaceSecurity.ps1 -namespace root -operation add -account ‘domain\user’ Enable,RemoteAccess,Methodexecute
I have tried both domain\username and also username@domain but still getting “Account was not found” errors.
I think it may have something to do with the PS script, but if anyone can shed any light, that would be much appreciated.
Thanks