So now that ConfigMgr CB 1702 is with us, in this post I am going to focus on one of the nice new features, namely the Content Library Cleanup tool – ContentLibraryCleanup.exe.

Maintenance.. Maintenance.. & More Maintenance

Prior to CB 1072 when content was orphaned on a distribution point, the process of removing this redundant data was in the hands of the ConfigMgr admin. If you are distributing a significant number of packages, over time the amount of redundant data can be significant and the process of cleaning this data up manually can be both difficult and time consuming to orchestrate in a large environment.

They Listened

In the latest current branch release, the product team have included a little gem to take care of this part of your essential maintenance toolkit, namely the ContentLibraryCleanup.exe tool.

The ContentLibraryCleanup.exe Tool

This new utility is a command line based program that compares the content of distribution points with the packages currently deployed from a specified site server. This way a map of the content is built up and the redundant objects are flagged by the tool for deletion.

Running the tool is a simple process;
  1. Obtain the ContentLibraryCleanup.exe from the following directory on your site server in your primary site – %CM_Installation_Path%\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup\
  2. Open a Command Prompt / PowerShell Console and use the utility using the following format to get an estimate of how much data can be saved;
    ContentLibraryCleanup.exe /dp “Name of your distribution point to clean” /ps “FQDN of the primary site that the distribution point belongs to” /sc “Site code that the DP belongs to”
Content Library Cleanup Tool – Analysing
Failed to Deploy

Where content is found which failed to distribute, you might receive an error like the below;

In this instance you will need to remove the distribution point from the identified package.

The Microsoft documentation notes this in the known issues section;

Known issue When the tool is run, an error like the following might be returned when any package or deployment has failed, or is in progress:

  • System.InvalidOperationException: This content library cannot be cleaned up right now because package is not fully installed.

Workaround: None. The tool cannot reliable identify orphaned files when content is in progress or has failed to deploy. Therefore, the tool will not allow you to clean-up content until that issue is resolved

Huge Potential For Savings

So after a quick analysis of data on a test DP, I was surprised to see the following;

So in an instance whereby a small branch office DP serving 100 clients had just shy of 40GB’s of wastesd space, just think about the potential to automate the process of cleaning up your entire estate and the resulting disk space savings.

Cleaning Up Your Distribution Points

Running the tool to silently automate the deletion​ of redundant content is just a matter of including the /delete & /q switches.

After the cleanup process has completed you will have a log similar to the one below;

Looking at the server in question we can now verify the space savings;

Pre – Content Library Clean Up
Post – Content Library Clean Up
More Information

More info on this addition to ConfigMgr can be found on Mirosoft’s documentation site –

Maurice Daly
Maurice has been working in the IT industry since 1999. Technology focus includes Active Directory, Group Policy, Hyper-V, Windows Deployment (SCCM & MDT) and Office 365.

Maurice is a Microsoft MVP since 2017 in the area of Enterprise Mobility


  • Mark
    Posted at 11:05 April 11, 2017

    Hi, great article but I get an error about the user does not have the Full Administrator RBAC role and All Scope to run the tool. I’m using an Admin user which has the AD Group assigned to SCCM as Full Administrator. I don’t see where I can set the scope to ALL. Any ideas?

    • Maurice Daly
      Posted at 12:30 April 11, 2017
      Maurice Daly

      Hi Mark,

      You can check/set the security scopes in the ConfigMgr console. If you go to Administration – Security – Administrative Users – Pick the AD Group – Right Click – Properties – Security Scopes.


  • J
    Posted at 17:58 April 14, 2017

    In regards to Error: This content library cannot be cleaned up right now because package is not fully installed. I was able to resolve by this issue by deleting the package in questionon the SQL Box by Query on “dbo.SMSPackageHist” with command :

    select * from SMSPackagesHist where PkgID like ‘%xxx00204%’

    Deleting it with

    delete from SMSPackagesHist where PkgID like ‘%xxx00204%’

    Ran the Cleanup Tool again and was able to get past this point. Use /delete /q and feed up 88 gigs of space!

    • Maurice Daly
      Posted at 08:52 April 15, 2017
      Maurice Daly

      Hi Jeff,

      Editing the SQL database directly is not a Microsoft supported action, just FYI. You should have been able to get around this issue by removing the DP from the selected package DP list. But glad to see you managed to save 88Gb of space :).


  • Paul
    Posted at 03:16 April 21, 2017

    Hi Maurice

    Any suggestions for working with the “System.InvalidOperationException: This content library cannot be cleaned up right now because package is not fully installed.” error?

    I’ve currently getting this error with the package identified being the default Configuration Manager Client Package. I had an issue with this package distributing previously and I can’t remember exactly what I did to fix it but it involved various methods of resetting/re-generating. I haven’t had any issues with this package recently and certainly since the SCCM 1702 upgrade it appears to have been re-distributed ok but is now causing issues with the ContentLibraryCleanup Tool.

    Thanks in advance

    • Maurice Daly
      Posted at 12:36 April 21, 2017
      Maurice Daly

      Hi Paul,

      Have you tried removing the offending package from the DP which you have issues with rather than just re-distributing it?. You could also use the Content Library Explorer from the SCCM Toolkit ( to verify the package contents on your distribution group as a troubleshooting step.


  • Leave a Reply to Maurice Daly
    Cancel Reply