Tuesday 9 September 2014

Last Boot up time report

This Report will show the exact machine last boot up time, HW scan, last heartbeat:




SELECT 
a.Netbios_name0, 
e.Caption0 as OS, 
e.CSDversion0 as 'SP level',
a.resourceid,a.Creation_date0,
a.client0, 
a.ad_site_name0,
a.obsolete0,
b.sms_installed_sites0 as 'sitecode',
c.Lasthwscan,d.Agenttime as 'Last heartbeat discovery ran',
e.LastBootUpTime0,DATEDIFF(dd, LastBootUpTime0, GETDATE())AS 'Number of Days since last bootup'
from v_r_system a
left outer join v_RA_System_SMSInstalledSites b on a.resourceid=b.resourceid
left outer join v_GS_WORKSTATION_STATUS c on a.resourceid=c.resourceid
Left outer join v_AgentDiscoveries d on d.resourceid=a.resourceid
left outer join v_gs_operating_system e on e.resourceid=a.resourceid
where d.AgentName='Heartbeat Discovery' and (a.client0=1 and a.Obsolete0=0 and a.Active0=1)
and a.Name0 IN (SELECT Name0
FROM v_r_system
GROUP BY Name0
HAVING COUNT(*) < 2)
order by e.LastBootUpTime0 desc

1 comment:

  1. Hi- Thank you for this!

    How hard would it to take this code and have it target only a specific collection in SCCM?

    ReplyDelete

Give me you feedback!