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 Content Library Cleanup (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 to identify 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)
- We encounter the following error:
System.InvalidOperationException: This content library cannot be cleaned up right now because package 10000004 is not fully installed.
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary..ctor(String remoteDPFqdn, String primarySiteServerFqdn, String primarySiteCode)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String args)
This error happens becase 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
- 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
- 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)
All command line switches can be found on the Technet Documentation.