Cracknells.co.uk

ContentLib Clean-up 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

ContentLibraryCleanup folder

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

ContentLibraryCleanup

You can then run the tool in the format of:

.\ContentLibraryCleanup.exe /dp fqdn.example.com
ContentLibraryCleanup example

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:

ContentLibraryCleanup running

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.

ContentLibraryCleanup run

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.

ContentLibraryCleanup error

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 <fqdn.example.com /delete
ContentLibraryCleanup 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. Any orphaned files should have now been cleared from your content library (ContentLib).

ContentLibraryCleanup complete