# Reg: Service check and stop during windows update.

**URL:** <https://forum.ansible.com/t/reg-service-check-and-stop-during-windows-update/35998>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 16, 2021, 11:25am UTC](https://forum.ansible.com/t/reg-service-check-and-stop-during-windows-update/35998 "2021-11-16T11:25:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harsh\_chawda](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@harsh\_chawda](https://forum.ansible.com/u/harsh_chawda)\
**Post date:** [November 16, 2021, 11:25am UTC](https://forum.ansible.com/t/reg-service-check-and-stop-during-windows-update/35998/1 "2021-11-16T11:25:39Z")

</div>

Hello All,

I am doing windows server patching for some of the windows servers on my environment.

Now i have a requirement in which i have to check a service if it exists and stop it before installing update/patch.

can someone please help me on this such that playbook should first check for the service, stop it and then go for windows patching.

**Script i am using now for windows patch update:**

_- name: Windows Update_  
_hosts: all_  
_gather\_facts: false_  
_tasks:_  
_- name: Running Windows Update_  
_win\_updates:_  
_category\_names: [‘SecurityUpdates’,‘CriticalUpdates’,‘UpdateRollups’, ‘Updates’, ‘DefinitionUpdates’]_  
_reboot: yes_

**Thanks in advance**

---

<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:** [November 16, 2021, 11:27am UTC](https://forum.ansible.com/t/reg-service-check-and-stop-during-windows-update/35998/2 "2021-11-16T11:27:03Z")

</div>

Create a new play before this one to do your pretask.
