Deploy all Windows Updates during the SCCM 2012 Task Sequence

I noticed that when I put Windows Updates in the SCCM 2012 Task Sequence (“Deploy” and the “Build and Capture”) some Software Updates weren’t installed. Even after updating the Operating System Images Offline the issue still remained.

Reason and solution
After some investigation the answer was relatively simple; The Configuration Manager Client caches the results of a Software Update evaluation scan.
I Noticed that this cache has a rather long TTL, longer than the Task Sequence lasted.
This post is on how to update the deployment completely by flushing the Windows Update cache.

1. Force all updates to run in the task sequence
In the Configuration Manager console, navigate to Administration, choose Software library, Operating Systems, Task Sequences, and edit the Task Sequence which you want to modify.
– After the complete installation choose Add, New Group and change the name to Windows Updates
Add another subgroup called Install Software Updates I
– Add, General, Install Software Updates
and name it Install Software Updates I
Install Updates SCCM 2012 - 1

– Add another subgroup called Install Software Updates II
– Add, General, Run Command Line 
and name it Scan for  Updates II
– In the command line type: WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000113}” /NOINTERACTIVE
Install Updates SCCM 2012 - 2

– Add, General, Run Command Line and name it Wait for Scan to Finish II
– In the Command line type: Powershell.exe -command start-sleep 30 Install Updates SCCM 2012 - 3
– Add, General, Install Software Updates and name it Install Software Updates II
Install Updates SCCM 2012 - 4
– Copy the Install Updates II folder 3 times and change the description. After this the sequence will run and install all updates.