SCCM - SQL Report to show Maintance Windows for a Collection of system

Select fcm.Name,fcm.CollectionID as [Member of Collection], sw.Name as 'CEPSWName', sw.Description, sw.StartTime, sw.Duration as 'DurationMinutes', sw.IsGMT as 'StartTimeIsGMT', sw.IsEnabled as 'CEPSWEnabled',case when sw.ServiceWindowType=5 then '*' else ' ' end as 'OSDServiceWindow'
from v_ServiceWindow sw
join v_FullCollectionMembership fcm on sw.CollectionID = fcm.CollectionID
where in (select from  v_FullCollectionMembership where  v_FullCollectionMembership.collectionid=@CollID) and isnull(fcm.IsObsolete, 0)= 0

Create a prompt with variable name COllID by using the following query.

select CollectionID,Name from v_Collection


Post a Comment