5 ( 4 )

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 try ensure that your collections aren’t being refreshed unnecessarily. For collections where I have direct or include/exclude rules, I always uncheck the incremental and scheduled refresh boxes when setting up the collection. However, there’s one extra step that I haven’t been doing that requires just a bit of consideration before upgrading to 1810. The picture below is the setting in question.

Uncheck to set RefreshType to Manual

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

Change Recurrence pattern to None

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.

Share this Post

How useful was this post? Click on a star to rate it!







Submit Rating Average rating 5 / 5. Vote count: 4 No votes so far! Be the first to rate this post.