4 min read

ConfigMgr - Get collections with Incremental or Inc+Full evaluation schedule

ConfigMgr - Get collections with Incremental or Inc+Full evaluation schedule

You know that you shouldn't have to many collections using Incremental Updates, right?

"Enabling incremental updates for many collections might cause evaluation delays. It's best to limit the number of incrementally updated collections to 200."

As you can read in the MS page, it all depends as well, but a general rule, no more than 200.

So here's  a small PSScript to find all collections with either "Incremental Update" or "Incremental+Full Evaluation".
Run it to find them and get to work correcting them.

RefreshType 4 = Incremental
RefreshType 6 = Incremental+Full Eval


Finding collections

First of all, we need to connect load the Configuration Manager Powershell module. You can either do this from your ConfigMgr console:

Or you can run a function prior to the script, like this:

Function Import-MEMCMPSModule {
    [cmdletbinding(SupportsShouldProcess = $True)]
    Param(
        [Parameter(Mandatory = $true)]
        $ProviderMachineName,
        
        [Parameter(Mandatory = $true)]
        $SiteCode
    )

    Process {
        if ((Get-Module ConfigurationManager) -eq $null) {
            Try {
                Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"
            }
            Catch {
                $msgBoxInput = [System.Windows.MessageBox]::Show("ERROR: ConfigMgr PS module could not be loaded", 'ConfigMgr PS module', 'OK')
            }
        }
        if ((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
            New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName
        }


        Set-Location "$($SiteCode):\"
    }
}

Import-MEMCMPSModule -ProviderMachineName "cm01.corp.viamonstra.com" -SiteCode "ps1"

Or even better, add it to you PSProfile for quick and easy access, read up on it at this blog which i find explains it in a good way.

How To Make Use Of Functions in PowerShell – Jonathan Medd’s Blog

Getting to it!

Using the below script we get all collections where refreshtype is 4 or 6 and then we select the CollectionID and Name for output, and if we like to automate things further using script.

# Get collections with incremental or Full+Incremental Evaluation schedule
$Collections = Get-CMCollection | where {$_.RefreshType -eq "4" -or "6"} | select CollectionID,Name
Write-Output "Number of collections $($Collections.Count)"
$Collections | sort | ft -AutoSize
Get-CMCollection (ConfigurationManager) - Configuration Manager
Use this cmdlet to get a device or user collection object. Collections help you organize resources into manageable units. You can create collections to match your client management needs, and to perform operations on multiple resources at one time. Most management tasks rely on or require using one…

Bulk change evaluation schedule

After you found them, you can correct those you want to, using the console, after identifying which ones doesn't need incremental updates, most of the time a user actually can wait 30min until the application pops-up in software center...

Or, you could use powershell to speed up the process.
Bellow is an example which will set the collections to evaluate every 30 minutes.
Check out "New-CMSchedule" on how you can use it to create one for your preferences.

New-CMSchedule (ConfigurationManager) - Configuration Manager
Create a Configuration Manager schedule token.


I don´t want this schedule to be set on ALL my collections which is using refreshtype 4 or 6, but in this case, on all my collections which is for application deployment, and those are all named like "AM - ApplicationName", so i use powershell to only select those and set the schedule.

Script change evaluation schedule on specific collections

# Specify new evaluation schedule
$RefreshSchedule = New-CMSchedule -RecurInterval Minutes -RecurCount 30

# Select Collections matching my namingconvention
$ChangeCollection = $Collections | Where {$_.Name -like "AM - *"}

# Change Evaluation schedule
foreach($Collection in $ChangeCollection){
   Set-CMCollection -CollectionID $($Collection).CollectionID -RefreshType Periodic -RefreshSchedule $RefreshSchedule
}
Set-CMCollection (ConfigurationManager) - Configuration Manager
Use this cmdlet to configure a device or user collection. The limiting collection determines which resources can be a member of the collection. For instance, when you use the All Systems collection as the limiting collection, the new collection can include any device in the Configuration Manager hie…

And if we put it together into one script it could look something like this

# Get collections with incremental or Full+Incremental Evaluation schedule
$Collections = Get-CMCollection | where {$_.RefreshType -eq "4" -or "6"} | select CollectionID,Name
Write-Output "Number of collections $($Collections.Count)"
$Collections | sort | ft -AutoSize

# Specify new evaluation schedule
$RefreshSchedule = New-CMSchedule -RecurInterval Minutes -RecurCount 30

# Select Collections matching my namingconvention
$ChangeCollection = $Collections | Where {$_.Name -like "AM - *"}

# Change Evaluation schedule
foreach($Collection in $ChangeCollection){
   Set-CMCollection -CollectionID $($Collection).CollectionID -RefreshType Periodic -RefreshSchedule $RefreshSchedule
}

EndpointManagement/Set-CMCollectionEvalSchedule.ps1 at master · Love-A/EndpointManagement
Endpoint Management stuff galore! Contribute to Love-A/EndpointManagement development by creating an account on GitHub.