Software last run more the X days ago
----------------
select distinct SMS_R_System.ResourceId, SMS_R_System.Name from SMS_R_System inner join SMS_G_System_SoftwareUsageData on SMS_G_System_SoftwareUsageData.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareUsageData.FileName = "sol.exe" and SMS_G_System_SoftwareUsageData.StartTimeLocal > DateAdd(dd,-6,GetDate())
Software NOT run in x days
-----------------
select distinct SMS_R_System.ResourceId, SMS_R_System.Name from SMS_R_System where SMS_R_System.ResourceId not in (select distinct SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_SoftwareUsageData on SMS_G_System_SoftwareUsageData.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareUsageData.FileName = "sol.exe" and SMS_G_System_SoftwareUsageData.StartTimeLocal > DateAdd(dd,-6,GetDate()))