How to: Enable Incremental Collection Updates With PowerShell

ConfigMgr 2007 R3 shipped with a feature called Incremental Updates for collections, and ConfigMgr 2012 also supports this feature. From the official docs, here’s what incremental updates do for you:

Select this option to periodically scan for only new or changed resources from the previous collection evaluation and update the collection membership with only these resources, independently of a full collection evaluation. By default, incremental updates occur at 10 minute intervals.

This post will demonstrate how to identify collections with incremental updates enabled, as well as how to enable incremental updates for a collection.

Here’s an example to list all collections that have incremental updates enabled:

#display collections with incremental updates enabled
#replace mycfgmgrlab with site server name, LAB with Site code
gwmi sms_collection -computer mycfgmgrlab `
  -namespace root\sms\site_LAB | foreach {
  $Coll = [wmi] $_.__Path
  if ($Coll.RefreshType -eq 6) {
        write-host $Coll.CollectionID "`t" $Coll.Name
    }
}

Since RefreshType is a lazy property, you must take some extra steps. use get-wmiobject (alias is gwmi) to get all collections, then perform a for-each loop to use query the instance directly using the [wmi] accelerator for PowerShell. Finally, check to see if RefreshType = 6.

Here’s an example to enable incremental updates on a collection:


#enable incremental updates on a collection
#replace mycfgmgrlab with site server name, LAB with Site code,
#and LAB007DE with desired collecitonid
$a = [wmi] "\\mycfgmgrlab\root\sms\site_LAB:SMS_Collection.CollectionID='LAB007DE'"
$a.RefreshType = 6
$a.put()

Use the [WMI] accelerator to grab the specific instance with lazy properties, and set RefreshType = 6

Valid values for RefreshType:

  • 6 = Incremental and Periodic Updates
  • 2 = Periodic Updates only
  • 1 = Manual Update only

For more information about Incremental Updates, review’ the Microsoft page for Creating Collections in ConfigMgr 2012 (expand the node “To Create a Device Collection” to see the details.) Also note that the following classes do not support incremental updates:

  • SMS_G_System_CollectedFile
  • SMS_G_System_LastSoftwareScan
  • SMS_G_System_AppClientState
  • SMS_G_System_DCMDeploymentState
  • SMS_G_System_DCMDeploymentErrorAssetDetails
  • SMS_G_System_DCMDeploymentCompliantAssetDetails
  • SMS_G_System_DCMDeploymentNonCompliantAssetDetails
  • SMS_G_User_DCMDeploymentCompliantAssetDetails (for collections of users only)
  • SMS_G_User_DCMDeploymentNonCompliantAssetDetails (for collections of users only)
  • SMS_G_System_SoftwareUsageData
  • SMS_G_System_CI_ComplianceState
  • SMS_G_System_EndpointProtectionStatus
  • SMS_GH_System_*
  • SMS_GEH_System_*

More information about Lazy Properties:

Greg

Filed under: ConfigMgr 2007, ConfigMgr 2012, PowerShell, SDK

email

Written by , Posted .