Lists all maintenance windows by collection, type and name. For filtering wildcards "*" must be used. By default all maintenance windows will be displayed.Popovici Ioan @ SCCM-Zone.com0/ConfigMgr_A01/{5C6358F2-4BB6-4a1b-A16E-8D96795D8602}None33f94ec3-1e39-4466-a6ee-65619da20a87DataSource=Parameters!UserSIDs.Value/*
*********************************************************************************************************
* Requires | SQL, SCCM DB *
* ===================================================================================================== *
* Modified by | Date | Revision | Comments *
* _____________________________________________________________________________________________________ *
* Ioan Popovici | 2016-05-16 | First version *
* Ioan Popovici | 2018-08-21 | Added localizations, interactive sorting, updated template *
* Ioan Popovici | 2018-08-24 | Added filters for collection name and maintenance window name *
* ===================================================================================================== *
* *
*********************************************************************************************************
.SYNOPSIS
This SQL Query is used to get the Maintenance Windows.
.DESCRIPTION
This SQL Query is used to get the Maintenance Windows for the whole SCCM environment with Start Time and Duration.
.NOTES
Part of a report should not be run separately.
.LINK
https://SCCM-Zone.com
https://github.com/Ioan-Popovici/SCCMZone
*/
/*##=============================================*/
/*## QUERY BODY */
/*##=============================================*/
SELECT
Collection.Name AS Collection,
ServiceWindow.Name,
ServiceWindow.Description,
CASE ServiceWindow.ServiceWindowType
WHEN 1 THEN 'All Deployments'
WHEN 2 THEN 'Programs'
WHEN 3 THEN 'Reboot Required'
WHEN 4 THEN 'Software Updates'
WHEN 5 THEN 'Task Sequences'
WHEN 6 THEN 'User Defined'
END AS Type,
ServiceWindow.StartTime,
ServiceWindow.Duration,
CASE ServiceWindow.IsEnabled
WHEN 1 THEN 'Yes'
ELSE 'No'
END AS Enabled
FROM dbo.fn_rbac_ServiceWindow(@UserSIDs) AS ServiceWindow
JOIN v_Collection AS Collection ON Collection.CollectionID = ServiceWindow.CollectionID
ORDER BY Name
/*##=============================================*/
/*## END QUERY BODY */
/*##=============================================*/trueCollectionSystem.StringNameSystem.StringDescriptionSystem.StringTypeSystem.StringStartTimeSystem.DateTimeDurationSystem.Int32EnabledSystem.StringDataSource=Parameters!UserTokenSIDs.Value/* Get UserSID */
SELECT dbo.fn_rbac_GetAdminIDsfromUserSIDs (@UserTokenSIDs) AS UserSIDstrueUserSIDsSystem.StringDataSource=Parameters!ReportName.Value/* ReportDescription Dataset */
SELECT DISTINCT Description
FROM ReportServer.dbo.Catalog
WHERE Name = @ReportNameDescriptionSystem.String92.10864mm72.76041mm42.38625mm27.35846mm25.37992mm19.31458mm6.80433mmtrue=Fields!Name.Valuetrue=SrsResources.Localization.GetString("Name", User!Language)#4c68a2Middle2pt2pt2pt2pttrue=Fields!Description.Valuetrue=SrsResources.Localization.GetString("Description", User!Language)#4c68a2Middle2pt2pt2pt2pttrue=Fields!StartTime.Valuetrue=SrsResources.Localization.GetString("StartTime", User!Language)#4c68a2Middle2pt2pt2pt2pttrue=Fields!Duration.Valuetrue=SrsResources.Localization.GetString("Duration", User!Language)#4c68a2Middle2pt2pt2pt2pttrue=Fields!Enabled.Valuetrue=SrsResources.Localization.GetString("Enabled", User!Language)#4c68a2Middle2pt2pt2pt2pttrue=Sum(Count(Fields!Name.Value))Collectiontrue=SrsResources.Localization.GetString("Total", User!Language)#4c68a2Middle2pt2pt2pt2pt6.80433mmtruetrue=Fields!Name.Value#e6eefcMiddle2pt2pt2pt2pttruetrue=Fields!Description.Value#e6eefcMiddle2pt2pt2pt2pttruetrue=Fields!StartTime.Value#e6eefcMiddle2pt2pt2pt2pttruetrue=Fields!Duration.Value#e6eefcMiddle2pt2pt2pt2pttruetrue=Fields!Enabled.Value#e6eefcMiddle2pt2pt2pt2pttruetrueTextbox8#e6eefcMiddle2pt2pt2pt2pt6.80433mmtruetrueTextbox79#c6daf82pt2pt2pt2pttruetrueTextbox79#c6daf82pt2pt2pt2pttruetrue#c6daf82pt2pt2pt2pt3truetrue=Count(Fields!Name.Value)#c6daf82pt2pt2pt2pt6.35mmtruetrueTextbox80SkyBlue2pt2pt2pt2pttruetrueTextbox80SkyBlue2pt2pt2pt2pttruetrueSkyBlue2pt2pt2pt2pt3truetrue=CountDistinct(Fields!Name.Value)SkyBlue2pt2pt2pt2pt6.80433mmtruetrueTextbox83#7292ccMiddle2pt2pt2pt2pttruetrueTextbox83#7292ccMiddle2pt2pt2pt2pttruetrue#7292ccMiddle2pt2pt2pt2pt3truetrue=Count(Fields!Name.Value)#7292ccMiddle2pt2pt2pt2pt112.69088mmtrue=Fields!Collection.ValueCollectiontrue=SrsResources.Localization.GetString("Collection", User!Language)#4c68a2Middle2pt2pt2pt2pt39.42291mmtrue=Fields!Type.ValueTypetrue=SrsResources.Localization.GetString("Type", User!Language)#4c68a2Middle2pt2pt2pt2pt=Fields!Collection.Value=Fields!Collection.Value=Fields!Type.Value112.69088mmtruetrue=Fields!Collection.ValueSkyBlueTop2pt2pt2pt2pt=Fields!Type.ValueStartAndEnd=Fields!Type.Value39.42291mmtruetrue=Fields!Type.Value#c6daf8Top2pt2pt2pt2pt=Fields!Name.Value=Fields!Description.Value=Fields!StartTime.Value=Fields!Duration.Value=Fields!Enabled.ValuetrueTV_TypetrueTV_Collection39.42291mmtruetrueTextbox80SkyBlue2pt2pt2pt2pt112.69088mmtruetrueTotal#7292ccMiddle2pt2pt2pt2pt39.42291mmtruetrue#7292ccMiddle2pt2pt2pt2ptMaintenanceWindowData=Fields!Collection.ValueLike=Parameters!FilterCollectionName.Value=Fields!Name.ValueLike=Parameters!FilterMWName.Value12.76107mm0.9525mm33.56732mm431.42205mm1.47018in8.34071in0.4intruetrue=SrsResources.Localization.GetString("Description", User!Language)2pt2pt2pt2pttruetrue=SrsResources.Localization.GetString(Fields!Description.Value, User!Language)trueReport_DescriptionLabel5pt2pt2pt2ptReportDescription0.03157in0.127cm0.4in9.81089in10.45796in0.0375in0in16.98512in21.5ptWhite1.5ptWhite1.5ptWhite1.5ptWhite1.5pt4.72533cm#6e7b8b43.33153cm2.5333cmtruetrueEmbeddedLogoFitProportional0.05723in0.12701cm0.49111in1.47018in0.6007in0.0375in0in16.98512in10.75ptWhite0.75ptWhite0.75ptWhite0.75ptWhite0.75pttruetrue=SrsResources.Localization.GetString(Globals!ReportName, User!Language)1.63513cm0.12701cm0.89817cm24.91965cm2Middle2pt2pt2pt2pt#6e7b8b0.77603cmtruetruetruetrue="Page: " + Globals!PageNumber.ToString() + "of " + Globals!TotalPages.ToString()0.03528cm0.03175cm0.63492cm2.79292cm#6e7b8b29.7cm21cm2.54cm2.54cm2.54cm2.54cm1.27cmString=SrsResources.UserIdentity.GetUserSIDs(User!UserID)UserTokenSIDstrue7b5f538e-1262-4705-a7df-7d4d398a195e/Report Parts/UserTokenSIDs2015-02-25T10:56:20.9331936+01:00StringAdminIDUserSIDsUserSIDstrue2c7b7dc1-c255-43f4-b6eb-9836f5be644e/Report Parts/UserSIDs2015-02-25T10:56:21.3863414+01:00String=Globals!ReportNametrueStringtrueReportDescriptionDescriptiontruetrueStringtrue*trueFilter by Collection NameStringtrue*trueFilter by Maintenance Window Name=User!LanguageSrsResources, culture=neutralCm1fab2b54-57de-49d3-aea2-75b9febeb7dc