SQL Query to Export All SCCM Maintenance Windows

By | December 13, 2016

Maintenance windows tend to be illusive in Configuration Manager, especially in large environments with multiple admins. A common request that I receive from my customers is to “retrieve all of maintenance windows.” There isn’t a great report for this or an easy way to do this with PowerShell (yet). The easiest method I’ve found to do this with the most detailed information is through a simple SQL Query on the CM database.

query

SELECT c.Name, c.Comment,SW.IsEnabled, SW.CollectionID, c.MemberCount, SW.Description, SW.StartTime, SW.Duration

FROM v_ServiceWindow SW

JOIN v_Collection C ON C.CollectionID = SW.CollectionID

ORDER BY c.Name

The results of this query will give you the Name, Comments, Date/Time/Frequency, and Duration for every maintenance window in your environment, as seen below.

queryresults

 

Leave a Reply

Your email address will not be published.