An empty collection is a useful starting point for a cleanup review. Getting that list only needs the Configuration Manager module and a short pipeline.
Connect once
Run this in Windows PowerShell 5.1 on a machine with the Configuration Manager console installed. Use an account that can read the collections you want to inspect, and replace both example values with your site details.
$siteCode = 'ABC'
$provider = 'cm01.contoso.com' # Your site's SMS Provider
Import-Module ConfigurationManager -ErrorAction Stop
if (-not (Get-PSDrive -Name $siteCode -PSProvider CMSite -ErrorAction SilentlyContinue)) {
New-PSDrive -Name $siteCode -PSProvider CMSite -Root $provider -ErrorAction Stop |
Out-Null
}
Set-Location "${siteCode}:\"
The module ships with the console. Modern console installations add it to the module search path. If importing by name fails, check the installed path; Microsoft's connection instructions cover importing the manifest directly. The site drive gives subsequent cmdlets their site context.
Get the review list
$emptyCollections = Get-CMDeviceCollection -ErrorAction Stop |
Where-Object { $_.MemberCount -eq 0 } |
Select-Object Name, CollectionID, MemberCount, LimitToCollectionName |
Sort-Object Name
$emptyCollections
Get-CMDeviceCollection returns device collections visible to your account. This filters that result to zero members and keeps four properties useful for a review. No output means no visible collections matched.
MemberCount is a property of SMS_Collection. This reads the site's recorded membership; it doesn't force a fresh evaluation.
Export it
Still in the same session:
$outputPath = Join-Path $env:TEMP 'empty-device-collections.csv'
$emptyCollections | Export-Csv -LiteralPath $outputPath -NoTypeInformation -Encoding UTF8
$outputPath
The absolute filesystem path matters because the current location is a ConfigMgr site drive. This writes the local CSV; it doesn't modify the site.
Empty doesn't mean unused
A collection may intentionally have no members today: a deployment target waiting for devices, a maintenance group, or a collection used in another collection's rules. Review those relationships before deciding what to remove. The list above makes no deletion decision and runs no removal commands.
Draft review: verify the connection and output against your lab before publishing. These examples have not been run against a live ConfigMgr site as part of this draft.