Freigeben über


Powershell - How to Disable Incremental Collection Updates in Mass

Collections in System Center 2012 Configuration Manager represent logical groupings of resources, such as users and devices. You can use collections to help you perform many tasks, such as managing applications, deploying compliance settings, or installing software updates. You can also use collections to manage groups of client settings. For more information on Collections see the following "Introduction to Collections in Configuration Manager".

Incremental Collection Updates

When you enable incremental updates for a collection, Configuration Manager periodically scans for new or changed resources from the previous collection evaluation and updates a collections membership with these resources, independently of a full collection evaluation. By default, when you enable incremental collection updates, it runs every 10 minutes and helps keep your collection data up-to-date without the overhead of a full collection evaluation.

For most this seems like a great feature but for some of our larger customers with a high amount of clients and complex collections in the thousands we could start to see processing bottlenecks on our site servers.  For this reason our "Best Practices for Collections in Configuration Manager" Guide advises that you do not exceed 200 collections with Incremental Collection Updates enabled.

Now its hard to say that for any given customer that 200 collections will result in poor performance etc.. but its a good general baseline to start from and if you start seeing performance hits due to collection updates you might want to relax the amount of collections you are updating at any given time.

If you want to get a list of all the collections you have Incremental Collection Updates Enabled on you can head on over to Greg Ramsey's Blog where he wrote up just how to do this.

I took what Greg wrote up and extended it a little further to Disable all collections with Incremental Collection Updates Enabled with a filter for those special collections you don't want to disable.

 # ***************************************************************************
 # 
 # File: Disable-IncrementalCollectionUpdates.ps1
 #
 # Version: 1.0
 # 
 # Author: Brandon Linton
 # 
 # Purpose: Disables Incremental Collection Updates on Collections in ConfigMgr
 # 
 #
 # Usage: Run this script elevated on a system where PowerShell scripts
 # are enabled ("set-executionpolicy bypass").
 #
 # Possible Refresh Type Values:
 #
 # 6 = Incremental and Periodic Updates
 # 4 = Incremental Updates Only
 # 2 = Periodic Updates only
 # 1 = Manual Update only
 #
 #
 # ------------- DISCLAIMER -------------------------------------------------
 # This script code is provided as is with no guarantee or waranty concerning
 # the usability or impact on systems and may be used, distributed, and
 # modified in any way provided the parties agree and acknowledge the 
 # Microsoft or Microsoft Partners have neither accountabilty or 
 # responsibility for results produced by use of this script.
 #
 # Microsoft will not provide any support through any means.
 # ------------- DISCLAIMER -------------------------------------------------
 #
 # ***************************************************************************
 
 Function Disable-IncrementalCollectionUpdates
 {
 $ServerName = "."
 $SiteCode = @(Get-WmiObject -Namespace root\sms -Class SMS_ProviderLocation -ComputerName $ServerName)[0].SiteCode
 $Count = 0
 gwmi sms_collection -computer $ServerName `
 -namespace root\sms\site_$SiteCode | foreach {
 $Coll = [wmi] $_.__Path
 if ($Coll.RefreshType -eq 6 -And $Coll.CollectionID -notlike "SMS*") {
 write-host "Disabling Incremental Updates on: " $Coll.CollectionID "`t" $Coll.Name -ForegroundColor Yellow
 $Coll.RefreshType = 2
 $Coll.Put() | Out-Null
 $Count ++
 }
 }
 Write-Host $Count "Collections were updated."
 }
 
 Disable-IncrementalCollectionUpdates

 

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified
in the
Terms of Use .

DisableIncrementalCollectionUpdates.zip

Comments

  • Anonymous
    January 27, 2014
    Tyvm! Worked like charm!
  • Anonymous
    March 19, 2014
    This is excellent. Thank you for the script and link to Greg's blog. I made a script from both that excludes certain collections we want to leave alone and set it as a scheduled task.

    Thanks again!
  • Anonymous
    October 12, 2015
    Thanks just used this to turn it off on over 300 collections!