Starting with SCCM 1702, a new command line tool is available to remove content that is no longer associated with any package or application from a distribution point. The SCCM Content library cleanup tool (ContentLibraryCleanup.exe) can help you save up valuable space in a specific distribution point content library.

The tool will delete content from the library based on the specified distribution point when the tool is run.

SCCM Content Library Cleanup Tool Requirements

  • You can run the content library cleanup tool directly on the computer that hosts the distribution point or remotely from another server
  • You can run the tool from a single distribution point at a time
  • You will need to have Full Administrator RBAC Role and the “All” Security scope in the Configuration Manager hierarchy

Running the Tool

You can find ContentLibraryCleanup.exe in the SCCMInstallationDir\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup\ folder on the primary site or central administration site.

You can run the tool in 2 modes: What-If mode and Delete mode.

We will start by not specifying the /delete switch. The tool will run in What-If mode. This mode allows identifying the content that would be deleted from the distribution point.

  • On your Primary site, open an administrative command prompt and go to the ContentLibraryCleanup folder (see full path above)
  • Command : ContentLibraryCleanup /dp SCCM2012
    • The tool will check the content library on the SCCM2012 machine which is my distribution point (in What-If mode)
SCCM Content library cleanup tool
  • We encounter the following error:
SCCM Content library cleanup tool

System.InvalidOperationException: This content library cannot be cleaned up right now because package 10000004 is not fully installed.
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.LoadDistributedPackagesFromProvider()
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.LoadValidContentData()
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary..ctor(String remoteDPFqdn, String primarySiteServerFqdn, String primarySiteCode)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String[] args)

This error happens because the package ID 10000004 has content replication issues.

  • If you have this error, open the SCCM console and fix the replication issue on the specified package ID and rerun the tool
SCCM Content library cleanup tool
  • The tool runs and the log file is written to the temp folder of the user account that runs the tool. The log file will open automatically
SCCM Content library cleanup tool
  • Review the log file to see what could be deleted if the /delete switch is ran
  • When you’re fine with it, run the following command to delete the content:
  • ContentLibraryCleanup /DP SCCM2012 /Delete
    • Before deleting each file, you must confirm that the file should be deleted (Yes, No, All)
SCCM Content library cleanup tool

All command line switches for the SCCM Content library cleanup tool can be found on the Technet Documentation.

Comments (20)

Barun

01.31.2020 AT 02:38 PM
Our DP is on Primary Server and getting Error:- Loading distributed packages from provider... Because this distribution point is co-located with its site server, packages may correctly exist in the content library that are not distributed to the distribu tion point. Package deletion has been disabled. System.NullReferenceException: Object reference not set to an instance of an obj ect. at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Load OrphanData(Boolean whatIfMode) at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Clea nup(Boolean whatIfMode, Boolean quietMode, String logDir) at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String[] args)

Amrita

04.06.2020 AT 08:49 PM
I am having the same error. Where you able to move past this error?

Kcorrie

02.20.2020 AT 09:14 AM
I'm looking for help with this same message. Our original DP was setup on the site server but has since been moved. The DP role was removed from the site server, but SCCMContentLib remained. I reinstalled the DP role and ran ContentLibraryCleanup.exe but get this message. There are no packages distributed to the DP, but SCCMContentLib is still using 275 GB. I'd like to free up this disk space.

Andrews

08.28.2019 AT 08:47 AM
My version of sccm does not have the content library cleanup tool. Is there a place I can download one?

Mrinmoy Saha

07.22.2019 AT 11:14 AM
I have tried to use content library clean-up tool from DP and getting this below error. I run with admin privilege on servers and sccm and run directly on DP. Unable to load valid packages. Please check the specified site server location and ensure you have access to the site server and the provider

Ximena Ausejo

07.15.2019 AT 03:45 PM
This may be an oddball question but, I cleaned up a couple of packages that were corrupted. I want to redistribute it to the same dp I cleaned them from. The distr.log just keeps saying 'attempting to delete package xxxx, failed because the package is not there'. To add them back to the distribution, I click on the package, select deploy and then select the distribution point (it correctly shows the dp who doesn't have it) it goes thru the motion, but it doesn't get distributed. Do I just need to wait longer?

Jordan Cobb

05.20.2019 AT 09:51 AM
It would be great if it actually told you what it was deleting, instead of some obscure reference to a guid that only SCCM knows about. Would writing the real file path out to the console really be that hard?

Matthew Brahm

04.21.2020 AT 02:46 PM
You can find the GUID and reference it, it's really not that hard 😛

Jbobaroonie

10.25.2018 AT 03:09 PM
Why isn't there a better way of doing this? I have 40 DP, what a PITA

Artiriun

07.12.2019 AT 03:25 AM
You can script it with powershell foreach($line in (Get-Content .\DP.txt)) { .\ContentLibraryCleanup.exe /dp $line /delete /log .\log /q } Put this script in folder with ContentLibraryCleanup.exe and a file DP.txt wich contains all your DP

Martin

03.11.2020 AT 02:15 AM
i think one issue is that when you have a long runtime for the tool you run into issues with packages that start getting transfered to the DP (like SCEP Definitions and such) and then the tool won't work... anyone has a good idea how to solve that problem? i guess with 19xx its not an issue because of the maintenance mode but i have DPs in Argentina the tool takes a couple of hours to run and I will never be able to cleanup the DP :/

Gwyn Jones

06.05.2018 AT 11:25 AM
Had some good success, but now getting this on the majority of DP's when running the tool. System.Management.ManagementException: Unable to load valid packages. Please che ck the specified site server location and ensure you have access to the site ser ver and the provider. ---> System.Management.ManagementException: Quota violatio n at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStat us errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.Mo veNext() at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Load PackageToContentFromProvider() at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Load ValidContentData() --- End of inner exception stack trace --- at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Load ValidContentData() at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary..cto r(String remoteDPFqdn, String primarySiteServerFqdn, String primarySiteCode) at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String[] args)

Derek Greczyn

05.31.2018 AT 08:59 AM
The cleanup tool keeps getting hung up for me because I have a handful of packages that don't have content associated with them. I need this stuff as they are scripts with no content that I have deployed...anyone aware of a workaround?

tva

06.21.2018 AT 05:09 AM
Create dummy file taht you add to package so it has some content.

Adam

12.27.2017 AT 04:37 PM
I got the same error you got at first although I do not have anything with the Package ID it is referencing. Any ideas on how to move forward?

alan

10.13.2017 AT 01:03 PM
are you able to run this on secondary sites with no problem?

tony

05.11.2017 AT 06:13 PM
Can I run this on SCCM v1606?

Tushar

04.27.2017 AT 12:54 PM
How to identfy content which is not associated with any package and application?

Aaron Whittaker

05.11.2017 AT 01:24 AM
I think you might need to write your own PowerShell to do that. I was looking into doing that a while ago but never got around to it.