It's not uncommon to encounter thousands of collections in a large deployment of Microsoft SCCM. If the Refresh Cycle of the collections is not carefully managed, you may start to experience significant performance degradation. As a rule of thumb, you should not enable incremental updates on more than 200 collections, or configure too many collections with an aggressive periodic refresh cycle.
Related Articles
The following PowerShell script includes a few functions that can help to manage the refresh cycle of collections.
The get-incremental function will list the collections with incremental updates enabled.
The disable-incremental function will disable incremental updates, and enable periodic updates, on an array of collections. The periodic update schedule is set to daily, with a randomised hourly offset.
The enable-incremental function will enable incremental updates and periodic updates on an array of collections. The periodic update schedule is set to weekly, with a randomised hourly offset.
# site code.
$sitecode = 'lab'
# name of server hosting the sms provider.
$provider = 'sccm'
# create a recuring interval token with a cycle of x days.
# the start time will be randomised, but always on the hour.
function new-token($days = 1) {
$class = gwmi -list -name root\sms\site_$sitecode -class sms_st_recurinterval -comp $provider
$interval = $class.createinstance()
$interval.dayspan = $days
$interval.starttime = get-date (get-date '1/1/2016').addhours((get-random -max 24)) -format yyyyMMddHHmmss.000000+***
return $interval
}
# get the names of all collections enabled for incremental updates.
function get-incremental() {
$collections = @()
gwmi -name root\sms\site_$sitecode -class sms_collection -comp $provider | %{
$collection = [wmi]$_.__path
if ($collection.refreshtype -band 4 -and $collection.collectionid -notlike 'sms*') {
$collections += $collection.name
}
}
return $collections
}
# configure the refresh cycle for an array of collections.
# set $type to 2 for periodic refresh only, and 6 for incremental and periodic.
# set $days to the number days between each periodic refresh.
function set-schedule([array]$collections, $type, $days) {
$collections | %{
if (! ($collection = gwmi -name root\sms\site_$sitecode -class sms_collection -comp $provider -filter "name = '$_'")) { return }
$collection.refreshtype = $type
$collection.refreshschedule = new-token $days
#$collection.psbase()
$collection.put() | out-null
}
}
# disable incremental updates.
# i.e. enable periodic updates only, with a refresh cycle of 1 day.
function disable-incremental([array]$collections) {
set-schedule $collections 2 1
}
# enable incremental updates.
# i.e. enable incremental and periodic updates, with a refresh cycle of 7 days.
function enable-incremental([array]$collections) {
set-schedule $collections 6 7
}
To retrieve the name of all collections enabled for incremental updates:
get-incremental
To disable incremental updates on all collections listed in a file named disable.txt, and enable periodic updates with a daily cycle:
disable-incremental (get-content disable.txt)
To enable incremental and periodic updates on all collections listed in a file named disable.txt, with a weekly periodic refresh cycle:
enable-incremental (get-content enable.txt)