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

WME Security Briefing 27 May 2024

Kinsing Hacker Group Exploits Docker Vulnerabilities Overview Recent investigations have shown that the hacker group Kinsing is actively exploiting Docker vulnerabilities to gain unauthorized access to systems. The modified hacker group targets misconfigured Docker API ports deployed with cryptocurrency mining malware.

Read More »
WME Cybersecurity Briefings No. 010
Cyber Security

WME Security Briefing 20 May 2024

Advanced Persistent Threats: North Korean Hackers Launch Golang Malware Overview A new malware strain, called Titan Stealer, is currently actively circulating in the threat landscape, targeting a variety of personal data and linked to North Korean state-sponsored cyber espionage

Read More »
WME Cybersecurity Briefings No. 009
Cyber Security

WME Security Briefing 08 May 2024

Exploitable vulnerability in Microsoft Internet Explorer, used to deploy VBA Malware Overview Cybersecurity researchers discovered a severe exploitation targeting a bug that had already been patched in the Microsoft Internet Explorer browser. Their report added that

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=