You are here:   Research
  |  Login

Welcome to my blog, quickest way to find articles is usually to search for them.

Search in All Title Contents

Create a Maintenance Window in ConfigMgr with an offset from patch Tuesday

Jan 11 2018

So its that time of year again where it is time to create all those Maintenance Windows for your patch groups. If you are like me and don’t want to do them on actual patch Tuesday (not that Microsoft ever had any issues with their patches, right? ) you might miss an option in ConfigMgr to create the MW’s with an offset based on patch Tuesday. The reason you might want this is that sometimes the second Wednesday comes before the second Tuesday of the month.

For this reason I have created a PowerShell script to handle the logic and automate the creation of non-recurring MWs.

The script can be found here:

For example, to create a MW on Tuesday one week after patch Tuesday at 18.00 with a duration of 2 hours:

.\New-CMMaintenanceWindow.ps1 -SiteCode <sitecode> -MaintenanceWindowName "MW Tuesday 1800" -AddMaintenanceWindowNameMonth -CollectionID <CollectionID> -patchTuesday -adddays 7 -StartYear 2018 -StartHour 18 -StartMinute 0 -HourDuration 2 -MinuteDuration 0


To remove last years MW (if they all have a description stating the year) you can fire up a PowerShell prompt with the CM module loaded and run the following snippet.

$collections = @("<CollectionID1>","<CollectionID2>")
foreach($collection in $collections){
    Get-CMMaintenanceWindow -CollectionId $collection -MaintenanceWindowName *2017* |foreach {Remove-CMMaintenanceWindow -MaintenanceWindowName $_.Name -CollectionId $collection}

Have fun!

Twitter: @matbg

Deployment News

Happy deployment, and thanks for reading!

What our lawyers makes us say:

This information is provided "AS IS" with no warranties, confers no rights and is not supported by the authors or Deployment Artist.

Copyright © 2017 by Deployment Artist (the company behind deployment research). All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

Shorthand: Don't pass off our work as yours, it's not nice.

Blog Archive


Where you can meet us!

Live Stream Recordings
ConfigMgr 1806 and W10 OSD

5 Days - Mega Geek Week 
(multiple classes, ConfigMgr, OSD etc.)
- Johan Arwidmark, Mikael Nystrom...
Jun 10, 2019, Chicago, IL, US

4 Days - Windows 10 OSD Classes
- Johan Arwidmark
May 20, 2019, San Diego, CA, US
Jun 17, 2019, Culemborg, NL
Jul 8, 2019, Phoenix, AZ, US

5 days - ConfigMgr Classes
- Johan Arwidmark and Kent Agerlund
Apr 8, 2019, Chicago, IL, US
Apr 22, 2019, Houston, TX, US

Video-based trainings

MDT, Windows 10 and ConfigMgr Books

Contact Info