I’m trying to leverage Ansible WinRM so that I can run ad-hoc tasks against the servers in my homelab environment.
These tasks would include but are not limited to
- Windows Update Installation
- Zero-Day mitigations
- Batch software updates
- Other Misc Breakfixes
I believe that I’ve gotten ansible itself functional and the properties for the winrm connection and service account properly configured but an not entirely sure execute PowerShell or bat commands against systems via it using Foreman. I can now connect to Windows Systems using WinRM, however trying to run code pasted into the command box against them results in a bunch of errors that the python interpreter couldn’t be found on the target host.
For Linux hosts I can do the following for ad-hoc tasks.
- On the Hosts page,select the host(s) > Schedule Remote Job
- Leave Category as Commands, Job Template as “Run Command- SSH Default”
- Paste commands or .sh script into command field
- Submit
Is there a similar process I can use for Windows systems via WinRM, or do I have to create and specify an ansible playbook? My ideal goal is to be able to paste one or a few lines of code into the command box and then run it, but not sure if that’s doable?
Thanks!!!