Find all PC with HW and SW inventory dates greater than 180 days

This WQL query will show you all PCs with a HW and SW Scan date of greater than 180 days.

select 
    SMS_R_System.Name, 
    SMS_R_System.LastLogonUserDomain, 
    SMS_R_System.LastLogonUserName
from  
    SMS_R_System 
    inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId 
    inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId 
    inner join SMS_G_System_WORKSTATION_STATUS on SMS_G_System_WORKSTATION_STATUS.ResourceId = SMS_R_System.ResourceId 
    inner join SMS_G_System_LastSoftwareScan on SMS_G_System_LastSoftwareScan.ResourceId = SMS_R_System.ResourceId 
where 
    SMS_G_System_SYSTEM.SystemRole = "Workstation" 
    and SMS_G_System_COMPUTER_SYSTEM.Model != "%Virtual%" 
    and Datediff(DD,SMS_G_System_WORKSTATION_STATUS.LastHardwareScan, Getdate()) > 180 
    and Datediff(DD,SMS_G_System_LastSoftwareScan.LastScanDate, Getdate()) > 180

Leave a Reply

Your email address will not be published. Required fields are marked *