Collection for machines with OS installed in X number of days in Configuration Manager

Here is a useful WQL query you can use to create a collection of machines where the install date was less than a specific amount of days. In this query, it will find computers that have had the OS installed within the last 30 days (This value can be changed by editing the number in the last line). The query uses a dateDiff against the Operating System Install date. This is based on hardware inventory.




SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId


dateDiff(dd, SMS_G_System_OPERATING_SYSTEM.InstallDate, GetDate()) < 30