Skip to content

Instantly share code, notes, and snippets.

@timdenholm
Last active April 30, 2019 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timdenholm/3cd3de4c126d0026cbedcb7b0e6e06d6 to your computer and use it in GitHub Desktop.
Save timdenholm/3cd3de4c126d0026cbedcb7b0e6e06d6 to your computer and use it in GitHub Desktop.
Get SCCM Maintenance Window Memberships
SELECT
fcm.Name AS 'host',
cg.CollectionName AS 'sccm_collection_name',
fcm.CollectionID AS 'sccm_collection_id',
sw.Name AS 'sccm_mw_name',
CASE sw.ServiceWindowType
WHEN '1' THEN 'All Deployments'
WHEN '4' THEN 'Software Updates'
WHEN '5' THEN 'Task Sequences'
END AS 'sccm_mw_type',
sw.Description AS 'sccm_mw_description',
sw.Duration 'sccm_mw_duration'
FROM v_ServiceWindow sw
JOIN v_FullCollectionMembership fcm ON sw.CollectionID = fcm.CollectionID
JOIN v_R_System vrs ON fcm.ResourceID = vrs.ResourceID
JOIN Collections_G cg ON cg.SiteID = fcm.CollectionID
ORDER BY host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment