Clean-up ContentLib in Configuration Manager

In the past I have had problems with the content library (ContentLib) in Configuration Manager taking up more disk space than it should. Orphaned files get left in the library over time as deployment packages are deleted.

To remove any unneeded files, we can run a clean-up tool that is included in Microsoft Endpoint Configuration Manager. The tool can be found in the install directory of your Config Manager.

e.g. E:\Program Files\Microsoft Configuration Manager\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup

Open a PowerShell console as administrator and navigate to the folder:

You can then run the tool in the format of:

.\ContentLibraryCleanup.exe /dp <>

When run without any additional switches you will get a prompt to confirm you want to run it in ‘What-If’ mode. This will analyse your content library and show you how much space could be freed up but does not make any changes:

You will see that when it finishes you will be given an approximate amount of space that can be saved and a location to the log file that was created.

If you get the following message when the tool finishes, then there is a problem with one of your packages. In my case I had only just ‘Deployed’ a new package, so the content was still being copied and updated on the distribution point. Once this had finished, I rerun the tool, and all was well.

Once you are happy with the results you can run the tool with the ‘/delete’ switch which will remove any obsolete content from the content library. Read the warning prompt and continue if you are happy.

.\ContentLibraryCleanup.exe /dp <> /delete

You are then prompted at each package to confirm you want to delete it. You can use ‘a’ to ‘yes to all’.

Once the tool finishes it will give you the amount of disk space that has been freed up and the location of the log file that was created.