How to run a query to show devices in maintenance mode

Document ID : KB000033948
Last Modified Date : 14/02/2018
Show Technical Document Details
The query below shows devices in maintenance mode, along with their origin and schedule.

select distinct cs.name, cs.ip, cs.origin, ms.SCHEDULE_NAME, ms.DESCRIPTION, mw.START_TIME, mw.END_TIME from CM_COMPUTER_SYSTEM cs INNER JOIN MAINTENANCE_SCHEDULE_MEMBERS msm ON cs.cs_id=msm.CS_ID INNER JOIN MAINTENANCE_WINDOW mw ON msm.SCHEDULE_ID=mw.SCHEDULE_ID INNER JOIN MAINTENANCE_SCHEDULE ms ON msm.SCHEDULE_ID=ms.SCHEDULE_ID WHERE mw.END_TIME >=GETDATE()

or

select distinct cs.name, cs.ip, cs.origin, ms.SCHEDULE_NAME, ms.DESCRIPTION, CONVERT(VARCHAR(50), mw.START_TIME,100) as 'Start Time', CONVERT(VARCHAR(50), mw.END_TIME, 100) as 'End Time' from CM_COMPUTER_SYSTEM cs
INNER JOIN MAINTENANCE_SCHEDULE_MEMBERS msm
ON cs.cs_id=msm.CS_ID
INNER JOIN MAINTENANCE_WINDOW mw
ON msm.SCHEDULE_ID=mw.SCHEDULE_ID
INNER JOIN MAINTENANCE_SCHEDULE ms
ON msm.SCHEDULE_ID=ms.SCHEDULE_ID
WHERE mw.END_TIME >=GETDATE()

keywords: query to determine maintenance mode select in or not schedule window status