How to command remote Windows node from control node

This is a comment not a question. There are many ways to take action on a remote Windows node from the Ansible control node.

Use Ansible Modules (especially those starting with “win_”) to do something on a remote node

  • name: Copy a windows file from control node to remote node
    win_copy: src=“/etc/ansible/winFiles/getFileVersion.exe” dest=“C:/Temp/”

-name: Restart a remote node
win_reboot:

Use the Ansible “raw:” module to run commands or executables on the remote node

  • name: Issue a Windows command to run on a remote node from control node
    raw: Rename C:/temp/oldName.txt C:/temp/newName.txt

  • name: Issue a Powershell Cmdlet to run on a remote node from control node
    raw: Copy-Item “C:/source/.” -Destination “C:/destination/”

  • name: Execute windows executable previously copied to a remote node from the control node
    raw: C:/temp/getFileVersion.exe “C:/Windows/driver.dll”

Use the Ansible “script:” module to copy, run and delete a Powershell module on the remote node from the control node.

  • name: run a powershell script on a remote node from the control node
    script: /etc/ansible/psScripts/doesItemExist.ps1 “C:/TempBackup/”

Feel free to correct or expand this list.