Archive Empty Collections in ConfigMgr

Below is a script that will move empty collections to a particular folder in ConfigMgr. This can be helpful for cleanup and pairing down collections that are no longer needed. It will also write the moves to a log file, including when the collection was moved and where it was moved from. This log is written as a CSV file.

When you download the script, you must change the first three lines. In line one, insert your site code. In line two, type the path to the log file. In line three, input the folder to move the empty collections too. If they’re device collections, it should read like this:

“<site code>:\DeviceCollection\folder1\folder2”

If they’re user collections, it should read like this:

“<site code>:\UserCollection\folder1\folder2”

Capture

As written, this script will move collections with a member count of zero. You can modify that if you like by changing the value at the end of line 13:

Capture

User Collections

To run against user collections, you also need to modify line 13 to look like this:

$colls = get-cmusercollection | where-object -filterscript {$_.MemberCout -eq “0”}

Limitations

Currently, if you want to run this against user and device collections, you will need two scripts.

This script must be executed from a device with the ConfigMgr console installed.

[download id=”4912″]

Share:

Facebook
Twitter
LinkedIn

Contact Us

On Key

More Posts

Mastering Azure AD Connect - A Comprehensive Guide by WME
Active Directory

Mastering Azure AD Connect – A Comprehensive Guide

Modern businesses are fast moving toward cloud-based infrastructure. In fact, cloud-based business is not just a trend anymore but a strategic necessity. Microsoft’s Azure Active Directory (Azure AD) has become a frontrunner in this domain. It

Read More »
Security Best Practices in SharePoint
Office 365

Security Best Practices in SharePoint

Microsoft SharePoint is an online collaboration platform that integrates with Microsoft Office. You can use it to store, organize, share, and access information online. SharePoint enables collaboration and content management and ultimately allows your teams to

Read More »
The Ultimate Guide to Microsoft Intune - Article by WME
Active Directory

The Ultimate Guide to Microsoft Intune

The corporate world is evolving fast. And with that, mobile devices are spreading everywhere. As we venture into the year 2024, they have already claimed a substantial 55% share of the total corporate device ecosystem. You

Read More »
Protecting Microsoft 365 from on-Premises Attacks
Cloud Security

How to Protect Microsoft 365 from On-Premises Attacks?

Microsoft 365 is diverse enough to enrich the capabilities of many types of private businesses. It complements users, applications, networks, devices, and whatnot. However, Microsoft 365 cybersecurity is often compromised and there are countless ways that

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.