Link to home
Start Free TrialLog in
Avatar of Jaber MM
Jaber MM

asked on

SCCM query to get uptime for all machines

hello ,

i need sccm query to get the uptime for machines installed . anyone can help on provide this .

i have the below query and given syntax error :

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
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

I'm not a SCCM guy but PowerShell could provide the info you need:

http://powershellblogger.com/2016/01/get-last-computer-boot-time-or-up-time-with-powershell/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.