Quantcast
Channel: Support Portal
Viewing all articles
Browse latest Browse all 20315

Re : Asset status automatically disposed if not scanned in last X months.

$
0
0
Hi Sutot,

Sorry for the delay in response, kindly find the query given below which will give you the list of workstations that are not scanned for the last 30 days,

SELECT SystemInfo.WORKSTATIONNAME "Workstation",OsInfo.OSNAME "OS" ,  LONGTODATE(AUDITHISTORY.AUDITTIME) 'Last Scan Date', LONGTODATE(LASTSUCCESSAUDIT.AUDITTIME) 'Last Success scan' FROM SystemInfo LEFT JOIN OsInfo ON SystemInfo.WORKSTATIONID=OsInfo.WORKSTATIONID LEFT JOIN LastAuditInfo ON SystemInfo.WORKSTATIONID=LastAuditInfo.WORKSTATIONID  LEFT JOIN Resources ON SystemInfo.WORKSTATIONID=Resources.RESOURCEID LEFT JOIN AuditHistory ON LastAuditInfo.LAST_AUDITID=AuditHistory.AUDITID LEFT JOIN AuditFailureInfo ON AuditHistory.AUDITID=AuditFailureInfo.AUDITID LEFT JOIN AuditHistory LASTSUCCESSAUDIT ON LastAuditInfo.LAST_SUCCESS_AUDITID=LASTSUCCESSAUDIT.AUDITID  WHERE RESOURCEs.RESOURCESTATEID NOT IN (4,5)  AND  ((DATEDIFF(day ,dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (LASTSUCCESSAUDIT.AUDITTIME/1000),'1970-01-01 00:00:00'),GETDATE()) >=30) OR (LastAuditInfo.LAST_SUCCESS_AUDITID IS NULL))
ORDER BY 1

Regards
Charles
SDP Support - FAQ
ServiceDesk Plus - Help Desk Software of your Choice

Viewing all articles
Browse latest Browse all 20315

Trending Articles