Monday, April 21, 2014

how to create collection to computers without LastHardwareScan and LastSoftwareScan


here you can change the data as you like for my Ex :
STATUS.LastHardwareScan, Getdate()) > 60  
LastSoftwareScan.LastScanDate, Getdate()) > 30

also if you want Hardware only you can delete


    and Datediff(DD,SMS_G_System_LastSoftwareScan.LastScanDate, Getdate()) > 30


WQL Query :

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_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()) > 60       and Datediff(DD,SMS_G_System_LastSoftwareScan.LastScanDate, Getdate()) > 30

No comments:

Post a Comment