# how to install a specific KB from windows update

**URL:** <https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 17, 2020, 5:43pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955 "2020-05-17T17:43:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 17, 2020, 5:43pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/1 "2020-05-17T17:43:27Z")

</div>

I am trying to install a specific update KB4541509

but it is not getting installed. I got the playbook running but not getting installed

here is from the ansible win log

2020-05-17 10:22:51Z Creating Windows Update session…  
2020-05-17 10:22:51Z Create Windows Update searcher…  
2020-05-17 10:22:51Z Setting the Windows Update Agent source catalog…  
2020-05-17 10:22:51Z Requested search source is ‘windows\_update’  
2020-05-17 10:22:51Z Search source set to ‘windows\_update’ (ServerSelection = 2)  
2020-05-17 10:22:51Z Searching for updates to install  
2020-05-17 10:28:12Z Found 6 updates  
2020-05-17 10:28:12Z Creating update collection…  
2020-05-17 10:28:12Z Skipping update d1fe2427-174b-4b7b-ba04-69aa90060d12 - Microsoft .NET Framework 4.8 for Windows Server 2012 R2 for x64 (KB4486105) as it was not found in the whitelist  
2020-05-17 10:28:12Z Skipping update ce061df5-b9f2-475f-9850-50ad5b7b9693 - 2020-02 Security Update for Adobe Flash Player for Windows Server 2012 R2 for x64-based Systems (KB4537759) as it was not found in the whitelist  
2020-05-17 10:28:12Z Skipping update ebfa39a3-52fe-4ff1-b7d4-375ad1654c04 - 2020-03 Servicing Stack Update for Windows Server 2012 R2 for x64-based Systems (KB4540725) as it was not found in the whitelist  
2020-05-17 10:28:12Z Skipping update 533cf583-0396-4862-a1d5-6200a46f82ba - 2020-05 Security and Quality Rollup for .NET Framework 3.5, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows 8.1 and Server 2012 R2 for x64 (KB4556401) as it was not found in the whitelist  
2020-05-17 10:28:12Z Skipping update 2221dd34-39bb-4f16-b320-be49fe4a6b95 - Windows Malicious Software Removal Tool x64 - v5.82 (KB890830) as it was not found in the whitelist  
2020-05-17 10:28:12Z Skipping update 4aeb4fc1-39c2-4514-be30-33e57845a002 - 2020-05 Security Monthly Quality Rollup for Windows Server 2012 R2 for x64-based Systems (KB4556846) as it was not found in the whitelist  
2020-05-17 10:28:12Z Calculating pre-install reboot requirement…  
2020-05-17 10:28:12Z Native job completed with output:  
Name Value

* * *

updates {}  
found\_update\_count 0  
changed False  
reboot\_required False  
installed\_update\_count 0  
filtered\_updates {2221dd34-39bb-4f16-b320-be49fe4a6b95, 4aeb4fc1-39c2-4514-be30-33e57845a002, d1fe2427-174b-4b7b-ba04-69aa90060d12, ce061df5-b9f2-475f-9850-50ad5b7b9693…}

not sure why it was looking for those KB as I whitelisted only 1 KB to install

 ![Screen Shot 2020-05-17 at 10.40.06 AM.png](https://us1.discourse-cdn.com/ansible/original/2X/5/5e005f46cd9b3a94c399a480ea6b3ea10a443c19.png)

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 17, 2020, 8:07pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/2 "2020-05-17T20:07:33Z")

</div>

When you Run Windows Update it returns all available Updates as you can see from your Output it’s skipping as they aren’t in the Whitelist

Your WHEN statement is wrong. you need to Set it to something like when: update\_result.reboot\_required == True

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 18, 2020, 5:00am UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/3 "2020-05-18T05:00:09Z")

</div>

this is my error

FAILED! =\> {“msg”: “The conditional check ‘update\_result.reboot\_required == true’ failed. The error was: error while evaluating conditional (update\_result.reboot\_required == true): ‘update\_result’ is undefined\n\nThe error appears to be in ‘/home/tony/windows/install\_windows\_KBxxxxx\_updates.yml’: line 15, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: reboot host if required\n ^ here\n”}

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [May 18, 2020, 7:57am UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/4 "2020-05-18T07:57:38Z")

</div>

Your register statement on the win\_updates task is incorrectly indented

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 18, 2020, 12:39pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/5 "2020-05-18T12:39:54Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [May 18, 2020, 10:23pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/6 "2020-05-18T22:23:27Z")

</div>

any idea how I would installed one specific KB and ignore anything else from windows update?

would it be like this?

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 18, 2020, 10:59pm UTC](https://forum.ansible.com/t/how-to-install-a-specific-kb-from-windows-update/32955/7 "2020-05-18T22:59:17Z")

</div>

> > >

> > > It seems every Question you post in here 90% of the troubleshooting seems to be issues around your indentation, I’ll recommend reading up on the basic of Ansible and how yaml works if your having issues like these… Also can you Please fix this from the code you have above, Run it and see what error comes out from it ?

If you read the Ansible Doc on Win\_update [https://docs.ansible.com/ansible/latest/modules/win\_updates\_module.html](https://docs.ansible.com/ansible/latest/modules/win_updates_module.html) You code seems fine, again Run it and see what issues you get…
