Here’s a SQL query to return machines which have not run a Software Updates scan within the past 15 days.

SELECT DISTINCT 
  dbo.v_R_System.ResourceID, 
  dbo.v_R_System.Name0 AS ComputerName, 
  dbo.v_ScannedUpdates.ScanTime
FROM 
  dbo.v_ScannedUpdates INNER JOIN
  dbo.v_R_System ON 
  dbo.v_ScannedUpdates.ResourceID = dbo.v_R_System.ResourceID
WHERE 
  (dbo.v_ScannedUpdates.ScanTime IS NULL)
  OR
  (DATEDIFF(dd, dbo.v_ScannedUpdates.ScanTime, GETDATE()) > 15)

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s