One of the new features in Configuration Manager 2012 R2 is that you can configure Maintenance Windows only for Software Updates

image

We can configure all these new stuff with ConfigMgr cmdlets also 🙂

#Import ConfigMgr PSH Module Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") #Get the CMSITE SiteCode $SiteCode = Get-PSDrive -PSProvider CMSITE # Change the connection context Set-Location "$($SiteCode.Name):\" #Apply MW only to Task Sequence $Collection = Get-CMDeviceCollection -Name "MW 2 - LOB Servers" Set-CMMaintenanceWindow -CollectionID $Collection.CollectionID -ApplyToTaskSequenceOnly -Name "TEST 2" #Apply MW only to Software Updates $Collection = Get-CMDeviceCollection -Name "MW 2 - LOB Servers" Set-CMMaintenanceWindow -CollectionID $Collection.CollectionID -ApplyToSoftwareUpdateOnly -Name "TEST 2" #Modify existing Maintenance Window $Schedule = New-CMSchedule -DurationCount 1 -DurationInterval Hours -RecurCount 2 -DayOfWeek 4 -WeekOrder First -Start ([Datetime]"13:00") $Collection = Get-CMDeviceCollection -Name "MW 2 - LOB Servers" Set-CMMaintenanceWindow -CollectionID $Collection.CollectionID -Schedule $Schedule -Name "TEST 2" -ApplyToTaskSequenceOnly

Happy Scripting 🙂