Query to show workstations that has a scan status (MSSQL & PGSQL)

Query to show workstations that has a scan status (MSSQL & PGSQL)

Tested in build PGSQL (14300) and MSSQL (14306)

PGSQL & MSSQL:

Below query that will show the Assets that has a scan status.

select systeminfo.workstationname "Workstation Name",
LONGTODATE(audithistory.audittime) "Last Scanned on",
audithistory.auditstatus "Scan status"
from audithistory
left join systeminfo on systeminfo.workstationid=audithistory.workstationid
where audithistory.auditid in (Select max(audithistory.auditid) from audithistory group by workstationid)

 Below query shows only failed scan status.

select systeminfo.workstationname "Workstation Name",
LONGTODATE(audithistory.audittime) "Last Scanned on",
audithistory.auditstatus "Scan status"
from audithistory
left join systeminfo on systeminfo.workstationid=audithistory.workstationid
where audithistory.auditstatus!='SUCCESS'
and audithistory.auditid in (Select max(audithistory.auditid) from audithistory group by workstationid)

                New to ADManager Plus?

                  New to ADSelfService Plus?