Find Collections With Maintenance Windows in System Center Configuration Manager

With numerous device collections, it can be tedious and time consuming to hunt for maintenance windows that have bet set and on what collection. To obtain a list of all maintenance windows and the device collections where they are applied, run this query against the SCCM site database using SQL Server Management Studio.

In SQL Server Management Studio:
Click databases
Choose the primary site
click New Query

paste this query in and execute it:

SELECT c.Name, c.Comment,SW.Description, SW.StartTime, SW.Duration
FROM v_ServiceWindow SW
JOIN v_Collection C ON C.CollectionID = SW.CollectionID
ORDER BY c.Name