Showing All computers in SCCM that have software installed, with the last boot time listed



DECLARE @lookup as varchar (50)
set @lookup = ‘%’
SELECT     TOP (100) PERCENT dbo.v_R_System.Name0, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0,
DATEDIFF(Day,dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, GETDATE()) AS [Days since last boot],
dbo.v_GS_OPERATING_SYSTEM.Caption0

FROM         dbo.v_GS_OPERATING_SYSTEM 
INNER JOIN dbo.v_R_System ON dbo.v_GS_OPERATING_SYSTEM.ResourceID = dbo.v_R_System.ResourceID
WHERE     dbo.v_R_System.Name0 in 

(SELECT     vrs.Name0 FROM v_r_system AS vrs
JOIN v_GS_INSTALLED_SOFTWARE AS VIS ON VIS.resourceid = vrs.resourceid
JOIN v_GS_SoftwareFile AS sf ON SF.resourceid = vrs.resourceid

WHERE     VIS.productname0 LIKE @lookup 

GROUP BY vrs.Name0)


ORDER BY [Days since last boot]



Discover more from Christine Alifrangis

Subscribe to get the latest posts sent to your email.

Leave a Reply