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.

SELECT

*

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()) < 30

Comments (1)

  1. Anonymous says:

    I hope this more helpful :…………… 🙂

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client 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()) < 7

Skip to main content