SCCM 2012 R2 Slow Collection Refresh/Membership Update

Managed ad

By justin, 4 April, 2015

If you are having problems with collections taking a long time to refresh membership, it is very possible that you have incremental updates or collection membership evaluation schedule set of happen frequently on a large number of collections.

Rule of thumb:

  • limit incremental collection evaluation to no more than 200  collections
  • limit colection evaluation schedule to no more than 1 time in 4 hours.

See: https://technet.microsoft.com/en-us/library/gg699372.aspx

Ads disabled for Justin
Google AdSense 250x250

 

So now you have 1600 collections set at incremental updates, what do you do? You could manually change each and every collection... that will take days, so I slapped together a powershell script to do it for you. In this script it does not change the Membership Evaluation for the default collection or "*All Systems" since I need those to stay incremental. you will need to set the $SMSProvider variable in the beginning of the script to the server that has the SMS provider. Normally this is the Primary site server or SQL server. Also change the  $SiteCode variable to your SCCM site code. :

 

$SMSProvider="<SMSPrivider ServerName>"

$SiteCode="<SiteCode>"

Function create-ScheduleToken {

$SMS_ST_RecurInterval = "SMS_ST_RecurInterval"

$class_SMS_ST_RecurInterval = [wmiclass]""

$class_SMS_ST_RecurInterval.psbase.Path ="\\$SMSProvider\ROOT\SMS\Site_$($SiteCode):$($SMS_ST_RecurInterval)"

 

$script:scheduleToken = $class_SMS_ST_RecurInterval.CreateInstance()

if($scheduleToken)

{

$scheduleToken.DayDuration = 0

$scheduleToken.DaySpan = 1

$scheduleToken.HourDuration = 0

$scheduleToken.HourSpan = 0

$scheduleToken.IsGMT = $false

$scheduleToken.MinuteDuration = 0

$scheduleToken.MinuteSpan = 0

$scheduleToken.StartTime = (Convert-NormalDateToConfigMgrDate $startTime)

}

 

}

 

Function Convert-NormalDateToConfigMgrDate {

[CmdletBinding()]

param (

[parameter(Mandatory=$true, ValueFromPipeline=$true)]

[string]$starttime

)

return [System.Management.ManagementDateTimeconverter]::ToDMTFDateTime($starttime)

}

[datetime]$startTime = [datetime]::Today

import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')

Get-WmiObject sms_collection -computer "$SMSProvider" -namespace "root\SMS\Site_$($SiteCode)" | foreach {

 

$Coll = [wmi] $_.__Path

if (($Coll.RefreshType -eq 4 -or $Coll.RefreshType -eq 6) -and $coll.Name -notlike "*All Systems" -and $coll.CollectionID -notlike "SMS*") {

 

write-host $Coll.CollectionID "`t" $Coll.Name

 

$coll.RefreshType =2

create-ScheduleToken

$coll.RefreshSchedule=$scheduleToken

$coll.put()

}

}

 

Comments