SCCM Query to get uptime for machines installed

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 :

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’
LEFT OUTER JOIN dbo.v_GS_Operating_System os
ON ws.ResourceID = os.ResourceID
ON cs.ResourceID = os.ResourceID
WHERE os.Caption0 LIKE ‘%server%’
ORDER BY os.LastBootUpTime0 ASC
Jaber MMAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
it seems that you're using and for the quotes, it should be ' and ' instead.

spot the difference?
Jaber MMAuthor Commented:
@Ryan Chong

yes i am using the correct one but still the same ( ' ' )
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.