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
Picture of Matt Tinney

Matt Tinney

Professional IT executive & business leader having decades of experience with Microsoft technologies delivering modern-day cloud & security solutions.

Contact Us

=
On Key

More Posts

WME Cybersecurity Briefings No. 020
Cyber Security

WME Security Briefing 26 July 2024

Pro-Houthi Group Targets Yemen Aid Organizations with Android Spyware Overview A suspected pro-Houthi group, OilAlpha, is targeting humanitarian organizations in Yemen with advanced Android spyware. The operation is associated with the activity cluster codenamed OilAlpha. It

Read More »
WME Cybersecurity Briefings No. 019
Cyber Security

WME Security Briefing 23 July 2024

Samba File Shares Targeted by DarkGate Malware in Recent Cyber Offensive Overview Recent investigations by Palo Alto Networks uncover a brief but significant cyberattack campaign utilizing DarkGate malware. This malicious software exploited Samba file shares to

Read More »
WME Cybersecurity Briefings No. 018
Cyber Security

WME Security Briefing 15 July 2024

OVHcloud Mitigates Record-Breaking 840 Million PPS DDoS Attack Overview In April 2024, OVHcloud, a top French cloud computing firm, successfully stopped a massive DDoS attack. The attack hit a record-breaking rate of 840 million packets per second

Read More »
E-Commerce Security - Solutions for Online Retailers
Azure

E-commerce Security – Solutions for Online Retailers

Today’s hyper-charged e-commerce landscape demands top-notch cybersecurity measures. Cybersecurity for this bustling sector isn’t just about ticking a technical box; it’s the cornerstone of building trust. As businesses and consumers flock to the online space, the

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=