Welcome to PrajwalDesai.com. This blog has articles on Microsoft Technologies such as SCCM, Azure, Cloud, PowerShell, Security and other technologies.

Exploring SCCM ConfigMgr Content Library Cleanup Tool

28 2,322

This post talks about exploring SCCM ConfigMgr content library cleanup tool. The content library clean up tool deletes the orphaned content from SCCM distribution point. Any content that is not associated with SCCM app/package is considered as orphaned content. This tool was introduced in Technical Preview version 1612. The content library clean up tool is a command line tool. We will see how this command can be used to delete orphaned content and it’s usage as well. As per Microsoft this tool version will cease to function after March 1st 2017. The tool will be later included with release of Current Branch or a production ready out-of-band release.

You can run the content library cleanup tool directly on the computer that hosts the distribution point. Most of all you can run the tool remotely from another server. However you can run the tool against a single distribution point at a time. If you are running this tool then ensure you are a Full Administrator on the Configuration Manager hierarchy.

Tool Usage – The tool can be run in two modes What-if mode and Delete mode. When you run the tool in what-if mode it finds out the orphaned content that can be deleted from DP. However the content is not deleted. It logs about the content that can be deleted in a log file. By default the log file is located in user’s temp folder. This log file is opened automatically once the tool is run successfully. When the tool is run with /delete switch, the orphaned content is deleted from DP’s content library. Therefore it is recommended that you run the tool in What-If mode and review the resulting log file before you use the /delete switch.

The tool comes with multiple switches.

SwitchSwitch Info
/delete(Optional) Delete the content from DP
/q(Optional) Quiet mode, suppresses all prompts
/dp <DP FQDN>(Required) Specify distribution point FQDN
/ps <Primary Site FQDN>(Optional) Specify the FQDN of primary site the distribution point belongs to
/sc (site code)(Optional) Specify the site code of primary site the distribution point belongs to
/log(Optional) Outputs the result in a log file

 

Here is a video tutorial that shows how the configuration manager content library cleanup tool works.

Exploring SCCM ConfigMgr Content Library Cleanup Tool

Let’s explore the configmgr content library cleanup tool. If you have installed the SCCM tech preview 1612, you will find this tool under %CM_Installation_Path%\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup\ folder.

Exploring SCCM ConfigMgr Content Library Cleanup ToolI have copied the tool to a folder located on desktop. Run the command prompt as administrator and change the path to where tool is located. Run the command ContentLibraryCleanup.exe, the tool usage data is displayed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolThe below command is executed on a distribution point server. This server has got very less content on it. So when i run the command in whatifmode, as a result it identifies and outputs the amount on data (in bytes) that can be deleted from content library on distribution point server. The below screenshot shows that there is no orphaned content that can be freed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolThe below log file screenshot shows there is no content that can be freed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolIn this case running the tool in delete mode won’t delete any content.

ContentLibraryCleanup.exe  /delete /dp <DP FQDN> /log <log file path>

Exploring SCCM ConfigMgr Content Library Cleanup ToolThe log file shows approx 0 bytes were freed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolI copied this tool to my distribution point server located on prod environment. Running the tool in what-if mode. Type Y to proceed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolThe output shows approx 137,11,835 bytes of data can be freed.

Exploring SCCM ConfigMgr Content Library Cleanup ToolIn conclusion I have run the command with /delete mode on prod DP server and I confirm it works well. Let me know if you have tried this tool and how was it in comments section.

Exploring SCCM ConfigMgr Content Library Cleanup Tool Note – If you use the older version of the content library tool, then you end up seeing the error. This version of this tool is expired and cannot be used.

Exploring SCCM ConfigMgr Content Library Cleanup Tool