Today I upgraded my production SCCM/ConfigMgr environment from 1806 to 1810, but before I did, I took care of some housekeeping that saved me a fair amount of work on the backend. If you’re like me, you
The Issue
The Release Notes for SCCM 1810 state the following:
Previously, when you configured a schedule on a query-based collection, the site would continue to evaluate the query whether or not you enabled the collection setting to Schedule a full update on this collection. To fully disable the schedule, you had to change the schedule to None. Now the site clears the schedule when you disable this setting. To specify a schedule for collection evaluation, enable the option to Schedule a full update on this collection.
https://docs.microsoft.com/en-us/sccm/core/plan-design/changes/whats-new-in-version-1810#improvements-to-collection-evaluation
If you’re like me, you likely have scheduled refreshes happening for collections that you thought you’d disabled it on. In my prod environment, I have 2200+ collections and 1750 collections were affected by this issue.
If you have NOT already upgraded to ConfigMgr 1810, you can use the following PowerShell script to change disable the schedule to None for all of the collections where the checkbox has been unchecked.
If you have already upgraded to 1810, this script won’t help since any collections in this state prior to the upgrade are were updated to Periodic (RefreshType 2). Eswar Koneti has a great post and script to help you further.
Finding Affected Collections
Collections with the Schedule checkbox unchecked but with an active schedule can be found using the ConfigMgr PowerShell cmdlets. If you run this query before upgrading to 1810, you should expect to find some collections.
#Returns all Collections with a recurring collection and RefreshType of manual.
Get-CMDeviceCollection | Where-Object RefreshType -eq 1 | Where-Object {$_.RefreshSchedule.SmsProviderObjectPath -ne "SMS_ST_NonRecurring"}
If you run the above collection on 1810, you won’t find any collections in this state. Instead they will all have RefreshType 2 and can be found with this query:
#Returns all Collections with a recurring collection and RefreshType of Periodic.
Get-CMDeviceCollection | Where-Object RefreshType -eq 2
SCCM Remove Recurring Schedules Collections Script
The script is commented and walks through what each step does. The script simply selects all collections where RefreshType is 1 and RefreshSchedule is not SMS_ST_NonRecurring then updates the RefreshSchedule with a non-recurring schedule.
<#
.SYNOPSIS
Find all collections with a RefreshType of 1 (Manual) that have a recurring schedule set and update the schedule to non-recurring (None).
.NOTES
Author: Adam Gross
Twitter: @AdamGrossTX
Website: https://www.asquaredozen.com
.LINK
Originally posted on http://www.SystemCenterDudes.com
.HISTORY
1.0 - Original
#>
[cmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]
$SiteCode,
[Parameter(Mandatory=$true)]
[string]
$ProviderMachineName
)
#Connect to ConfigMgr
$initParams = @{}
if((Get-Module ConfigurationManager) -eq $null) {
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams
}
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
}
Set-Location "$($SiteCode):\" @initParams
#######################################################
#Set New Blank Schedule
$Schedule = New-CMSchedule -Start "01/01/2019 12:00 AM" -DurationInterval Minutes -DurationCount 0 -IsUtc:$False -Nonrecurring
#Get All Collections
$AllCollections = Get-CMDeviceCollection
Write-Host "Total Collections Count is: $($AllCollections.Count)"
#Filter to TargetCollections based on RefreshType of 1 which is Manual
$ManualRefreshCollections = $AllCollections | Where-Object RefreshType -eq 1
Write-Host "Total Collections with RefreshType of 1 is: $($ManualRefreshCollections.Count)"
#Get Collections with a RefreshSchedule that is recurring.
$RecurringCollections = $ManualRefreshCollections | Where-Object {$_.RefreshSchedule.SmsProviderObjectPath -ne "SMS_ST_NonRecurring"}
Write-Host "Total Collections with RefreshType of 1 and RefreshSchedule of Recurring: $($RecurringCollections.Count)"
$Count = 0
#Loop through each RecurringCollection and update the schedule to be non-recurring
ForEach($Collection in $RecurringCollections)
{
$Count ++
Write-Host "#############################"
Write-Host "Processing Record $($Count) of $($RecurringCollections.Count): $($Collection.Name)"
$Collection | Set-CMDeviceCollection -RefreshSchedule $Schedule
Write-Host "Updated: $($Collection.Name)"
}
You can download the latest copy of the script from the GitHub Repo.
Marcio Hunecke
04.06.2019 AT 12:26 PMPaul Andrews
03.12.2019 AT 11:03 AMPaul Andrews
03.12.2019 AT 04:10 PMStewart Pollock
02.21.2019 AT 11:25 AMRich
01.22.2019 AT 09:27 AMAdam Gross
01.22.2019 AT 10:09 AMPaul Andrews
01.22.2019 AT 08:32 AMAdam Gross
01.22.2019 AT 09:59 AMPaul Andrews
01.22.2019 AT 10:44 PMAdam Gross
01.22.2019 AT 10:51 PMPaul Andrews
02.27.2019 AT 05:51 PMAdam Gross
02.28.2019 AT 09:10 AMDarryl Messinger
01.22.2019 AT 07:56 AMAdam
01.22.2019 AT 10:32 AM