# Windows Update script fails

**URL:** <https://forum.ansible.com/t/windows-update-script-fails/36709>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 9, 2022, 2:42pm UTC](https://forum.ansible.com/t/windows-update-script-fails/36709 "2022-06-09T14:42:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Hollyoak](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Stephen\_Hollyoak](https://forum.ansible.com/u/Stephen_Hollyoak)\
**Post date:** [June 9, 2022, 2:42pm UTC](https://forum.ansible.com/t/windows-update-script-fails/36709/1 "2022-06-09T14:42:34Z")

</div>

I have a script which installs windows updates, but the script fails if there are no updates to be installed.

Is there a way that the script can check to see if updates are needed and it not then just do nothing and the script can run successful.

My script is:

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [June 9, 2022, 4:36pm UTC](https://forum.ansible.com/t/windows-update-script-fails/36709/2 "2022-06-09T16:36:05Z")

</div>

You can use information from [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_error\_handling.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html) like adding entries like:

ignore\_errors: true  
changed\_when: false  
failed\_when: false
