Let’s understand how to use ConfigMgr Content Library Cleanup Tool (ContentLibraryCleanup.exe). The SCCM DP content library cleanup is to help the admin to remove the orphaned content. This tool helps to avoid hacking around WMI to remove orphaned content.
Well, ContentLibraryCleanup.exe is NOT a GUI-based tool instead it’s a command-line tool. I don’t like command-line tools because it’s easy to make mistakes. So, you need to be a very clear understanding of the parameters of the ConfigMgr Content Library Cleanup Tool.
Related Post – How To Use ConfigMgr Content Library Explorer Tool
Let’s me put the warning (This tool should be run with care) as part of the prerequisite because it contains details of permissions required to run the Content Library Cleanup Tool.
The following are some of the critical requirements/prerequisites to run this tool.
- Administrative access to the distribution point.
- “Full Administrator” RBAC role.
- “All” scope.
- If you are running the tool remotely, please ensure your network is secure.
- The tool is running in What-If mode and will not alter the content library.
- The tool doesn’t support removing content from the site server, which has a single content library.
- The tool doesn’t support a content-enabled cloud management gateway or a cloud-based distribution point.
Where is ContentLibraryCleanup.exe
The Content Library Cleanup Tool command line tool is part of CD.latest folder.
- F:\Program Files\Microsoft Configuration Manager\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup\ContentLibraryCleanup.exe
How to Use Content Library Cleanup Tool
You can copy the ContentLibraryCleanup.exe from the site server to remote DP. Once copied to remote distribution point you can run the tool from that DP server.
The following are some of the examples that you can use:
|Scenario||Command Line Example||Details|
|What-If @ DP||ContentLibraryCleanup.exe /dp DPserver1.MEMCM.com||DP Server FQDN|
|What-If @ Secondary server DP||ContentLibraryCleanup.exe /dp DPserver1.MEMCM.com /ps PrimaryMEMCM.com /sc ABC||Primary Server FQDN and Primary server site code|
|Deletion @ DP||ContentLibraryCleanup.exe /dp DPServer.MEMCM.com /delete||Remote DP FQDN|
|Silent Switch to Delete @ DP||ContentLibraryCleanup.exe /q /dp DPServer.MEMCM.com /delete||/q silent switch|
|Enable Logging with What-If||ContentLibraryCleanup.exe /dp DPServer.MEMCM.com /log C:\Users\Administrator\Desktop||/log to enable logging|
|Enable Logging with Deletion||ContentLibraryCleanup.exe /dp DPServer.MEMCM.com /delete /log C:\Users\Administrator\Desktop||/Log /Delete deletion with logging|
What if Option
First, we need to analyze the content from the DP to reduce the risk. You can use the What-if mode to identify the orphaned content that would be deleted from the distribution point. I recommend running the what-if mode of the Content Library Cleanup tool before doing the actual deletion.
The following are the steps completed by content library cleanup tool with What-If parameter:
- Are you sure you want to proceed (What-If mode)? ‘y’ = yes / ‘n’ = no :: Y
- Gathering information…
- Loading information from distribution point…
- Analyzing local files, 0.00% complete…
- Analyzing local files, 100.00% complete…
- Loading package data from provider…
- Loading local package data…
- Loading distributed packages from provider…
- System.InvalidOperationException: This content library cannot be cleaned up right now because package MEM00020 is not fully installed.
There is an error with What-If mode as you can notice in the above screenshot. You need to complete the package distribution before you can proceed with the use of the SCCM DP content library cleanup tool. One more error is shown in the screenshot below.
NOTE! – If any of the package distribution is failed, then you can’t run this tool. You need to fix the package distribution to the DP and then you can run the cleanup tool.
Content Library Cleanup Tool Error – System.InvalidOperationException: This content library cannot be cleaned up right now because package MEM00020 is not fully installed.
Primary and DP on same server Error – Approximately 0 bytes would have been freed if this tool was run in delete mode. Because this distribution point is co-located with its site server, packages may correctly exist in the content library that are not distributed to the distribution point. Package deletion has been disabled.