You are here:   Research
  |  Login

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

Minimize
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:
https://github.com/matbe/PowerShell/blob/master/ConfigMgr/New-CMMaintenanceWindow.ps1

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

image

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!
/Matt

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

Minimize




Where you can meet us!

Live Stream Recordings
ConfigMgr 1806 and W10 OSD

Windows 10 OSD Classes (US)
Nov 5, 2018, Phoenix, US
Dec 10, 2018, Chicago, US

Windows 10 OSD Classes (Europe)

Sep 4, 2018, Culemborg, The Netherlands

ConfigMgr CB Classes (US)
Aug 27, 2018, New York, US
Nov 12, 2018, San Diego, US

Video-based trainings
https://online.truesec.com
https://deploymentartist.com/Training/Videos

MDT, Windows 10 and ConfigMgr Books
http://deploymentartist.com/Books

Contact Info
http://deploymentresearch.com/theteam