How to use SCCM Content Library Cleanup Tool

Benoit LecoursSCCM5 Comments

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)

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 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

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

SCCM Content library cleanup tool

  • 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 can be found on the Technet Documentation.

 

How to use SCCM Content Library Cleanup Tool
5 - 2 votes

Founder of System Center Dudes. Based in Montreal, Canada, Senior Microsoft SCCM Consultant, 4 times Enterprise Mobility MVP. Working in the industry since 1999. His specialization is designing, deploying and configuring SCCM, mass deployment of Windows operating systems, Office 365 and Intunes deployments.

5 Comments on “How to use SCCM Content Library Cleanup Tool”

    1. 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.

  1. Pingback: How to use SCCM Content Library Cleanup Tool |

Leave a Reply

Your email address will not be published. Required fields are marked *