View Server Last Reboot query

From ConfigMgr, how can I get a list of servers with the last reboot time?

Use this query as a starting point, modify as needed, create a report if this information is needed on a frequent basis.


SELECT
cs.Name0 AS 'ComputerName',
DATEDIFF(HOUR, os.LastBootUpTime0, ws.LastHWScan)
  
AS 'Uptime (in Hours)',
CONVERT(VARCHAR(26), os.LastBootUpTime0, 100)
  
AS 'Last Reboot Date/Time',
CONVERT(VARCHAR(26), ws.LastHWScan, 101)
  
AS 'Last Hardware Inventory'
FROM
dbo.v_GS_WORKSTATION_STATUS ws      
LEFT OUTER JOIN dbo.v_GS_Operating_System os
 
ON ws.ResourceID = os.ResourceID
LEFT OUTER JOIN dbo.v_GS_COMPUTER_SYSTEM cs
 
ON cs.ResourceID = os.ResourceID
WHERE os.Caption0 LIKE '%server%'      
ORDER BY os.LastBootUpTime0 ASC

Advertisements
This entry was posted in SQL, SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

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