Help with Uptime since last reboot report.
I found this report https://www.itninja.com/question/k1000-reporting-custom-uptime-since-last-reboot-report. This report is will very handy and it works but I was wondering if someone helps me adjust the filtering? I'm only looking for Windows 10 machines.
I tried creating a smart label with only windows 10 but it doesn't like it.
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE WHERE ((OS_NAME like '%Microsoft Windows 10 Pro x64%') AND WHERE
left(UPTIME, locate(',', UPTIME) -1) > 15
This is what I have so far
SELECT MACHINE.NAME AS SYSTEM_NAME, USER_LOGGED, USER_FULLNAME,OS_NAME as OS_Name, (CONCAT(SUBSTRING_INDEX(UPTIME, ',', 1), ' days, ', SUBSTRING(UPTIME, LOCATE(',', UPTIME) + 1, LOCATE(':', UPTIME) - LOCATE(',', UPTIME) - 1), ' hours, ', SUBSTRING_INDEX(UPTIME, ':', -1), ' minutes')) AS UPTIME FROM MACHINE WHERE ((( exists (select 1 from LABEL, MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID AND MACHINE_LABEL_JT.LABEL_ID = LABEL.ID AND LABEL.TYPE <> 'hidden' and LABEL.NAME = 'UpTimeSinceLastReboot')) )) ORDER BY UPTIME desc
Answers (2)
Will just adding the OS to the WHERE statement do what you need
SELECT
MACHINE.NAME AS SYSTEM_NAME,
USER_LOGGED,
USER_FULLNAME,
OS_NAME as OS_Name,
(CONCAT(SUBSTRING_INDEX(UPTIME, ',', 1), ' days, ', SUBSTRING(UPTIME, LOCATE(',', UPTIME) + 1, LOCATE(':', UPTIME) - LOCATE(',', UPTIME) - 1), ' hours, ', SUBSTRING_INDEX(UPTIME, ':', -1), ' minutes')) AS UPTIME
FROM MACHINE
WHERE ((( exists (select 1 from LABEL, MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID AND MACHINE_LABEL_JT.LABEL_ID = LABEL.ID AND LABEL.TYPE <> 'hidden' and LABEL.NAME = 'UpTimeSinceLastReboot')) )) AND (OS_NAME like '%Microsoft Windows 10 Pro x64%')
ORDER BY UPTIME desc