Ansible 'win_shell' working on one server and giving error on another:

Team,

Ansible ‘win_shell’ working on one server and giving error on another:

Success on ‘mytest.mydomain.com’ with .Net framework 4.5 and PowerShell 4.

[user@server1]# ansible -i /etc/ansible/hosts windows-servers -m win_shell -a ‘dir’
mytest.mydomain.com | SUCCESS | rc=0 >>

Directory: C:\Users\Administrator.MYTESTDC1

Mode LastWriteTime Length Name


d-r-- 2/2/2018 5:11 AM Contacts
d-r-- 2/28/2018 1:37 AM Desktop
d-r-- 3/8/2018 3:45 AM Documents
d-r-- 2/28/2018 1:36 AM Downloads
d-r-- 2/2/2018 5:11 AM Favorites
d-r-- 2/2/2018 5:11 AM Links
d-r-- 2/2/2018 5:11 AM Music
d-r-- 2/2/2018 5:11 AM Pictures
d-r-- 2/2/2018 5:11 AM Saved Games
d-r-- 2/2/2018 5:11 AM Searches
d-r-- 2/2/2018 5:11 AM Videos

Failure o****n 'win01.itnetwork.com’ with .Net framework 4.5 and PowerShell 3. (other Ansible modules are working OK)

[user@server1]# ansible -i /etc/ansible/hosts WIN01 -m win_shell -a ‘dir’
win01.itnetwork.com | FAILED | rc=1 >>
Thread failed to start.
non-zero return code

Ansible Server Version: 2.5.0

Please suggest what could be the reason of error and how it can be resolved?

Thank you,
Dinesh Vashisht

If you have PowerShell 3.0 I would look to see if the WMF 3.0 hotfix KB2842230 is installed which fixes a memory issue on this version.

I’ve got a script to do this if you want to use that, otherwise you can manually install it yourself https://github.com/jborean93/ansible-windows/blob/master/scripts/Install-WMF3Hotfix.ps1.

Thanks

Jordan

Hello Jordan,

As advised, installing WMF 3.0 hotfix KB2842230 solved the problem.

Thank you,

Dinesh Vashisht