# windows host automation

**URL:** <https://forum.ansible.com/t/windows-host-automation/35637>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [August 19, 2021, 9:30am UTC](https://forum.ansible.com/t/windows-host-automation/35637 "2021-08-19T09:30:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Jain](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sakshi\_Jain](https://forum.ansible.com/u/Sakshi_Jain)\
**Post date:** [August 19, 2021, 9:30am UTC](https://forum.ansible.com/t/windows-host-automation/35637/1 "2021-08-19T09:30:49Z")

</div>

For windows host

How to write tasks in ansible :

1. Login into RDP machine
2. Login into other machines from RDP machine
3. Read email before starting the patching in the scheduled time
4. Run any commands in rdp machine , like below :
5. To shutdown : shutdown /r /f /m \
6. Reboot status : systeminfo /s | find “ System Boot Time “
7. Verify the timezone
8. Uptime of the server , store it in a file
9. Check ToNCR task from task scheduler , task is scheduled as cron job in every 5minutes
10. Send email to predefined recipients for task update
11. Read logs , scheduler logs , hmlogs , publish logs

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [August 19, 2021, 9:35am UTC](https://forum.ansible.com/t/windows-host-automation/35637/2 "2021-08-19T09:35:18Z")

</div>

For of all ansible does not use rdp not any windows gui automation. Translate that to actions that you can do programmatically and come back

---

<div class="post-metadata">

**Author:** ![Melvin\_Satheesan](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Melvin\_Satheesan](https://forum.ansible.com/u/Melvin_Satheesan)\
**Post date:** [August 19, 2021, 10:41am UTC](https://forum.ansible.com/t/windows-host-automation/35637/3 "2021-08-19T10:41:06Z")

</div>

You won’t use rdp to communicate with windows.

You can use winrm, 3389 is the port.  
windows\_upadate module is available in ansible.

You can use \* in category name Or you can create an array and pass the update type.

Reboot too can be achieved by giving a boolean attribute.

Rather taking system update in the same play, use another play for ping test and system info so that you will get a comprehensive list.
