We wanted to run a Task Sequence after an Operating System Deployment. The OSD image would have only Office,Antivirus, and Windows. The task sequence would have all the other common packages we roll out (Adobe Reader and Flash, Firefox, Quicktime, Java . . .). The problem was that I wanted an easy way to deploy all the packages at once, and an easy way to keep it up to date.
First we created a Collection (that updates every 5 mins) based on the following query:
SELECT SMS_R_System.Name, SMS_G_System_OPERATING_SYSTEM.InstallDate FROM SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId WHERE DATEDIFF(dd,SMS_G_System_OPERATING_SYSTEM.InstallDate,GetDate()) < 2 ORDER BY SMS_G_System_OPERATING_SYSTEM.InstallDate DESC
This query returns all the machines that have had their operating system installed in the last 2 days.
Next we created a Task Sequence that Installed all the packages, and advertised it to the new collection.
Now within a few mins of a machine adding itself to SCCM, it will show up in the collection, and the Task Sequence will be able to be run.
The key was the query to find the machines that have been installed recently. Thanks xrobx99 for your help with this!