Jump to content


anyweb

What is the ContentLibraryCleanup tool and how can I use it ?

Recommended Posts

Introduction

Microsoft have released a new version of the ContentLibraryCleanup tool for System Center Configuration Manager in the latest Technical Preview release (TP1701).

By upgrading your Technical Preview release to version 1701 you can start testing the new features of the tool today, and some of these new features have been requested on UserVoice, a forum where people can ask for changes to a product, get others to vote their idea up, and if enough interest is seen, to fulfill a need.

About the tool

This tool first surfaced in Technical Preview 1612. It’s designed to find content that is broken in one form or another on your distribution points (for whatever reason) and to alert you, or to free up space by deleting that broken content. It was designed to be cautious, if it doesn’t know exactly what is going on it will quit rather than accidentally delete files.

 

Note: The tool is currently in Technical Preview so avoid running it in a Production environment.

You can run the tool from the Primary site, or if speed is important, run it from the distribution point you are targeting. In fact, you can run the tool from anywhere that can do remote WMI calls to the provider/Distribution Point and SMB calls to the Distribution Point.

 

It can be found in the following location (after you’ve installed the latest Technical Preview release), where <driveletter> is the drive letter that you installed ConfigMgr on:

<driveletter>\Program Files\Microsoft Configuration Manager\cd.latest\SMSSETUP\TOOLS\ContentLibraryCleanup

contentlibrarycleanup-1.png

 

Note that you’ll need appropriate access to the cd.latest folder, so press Continue in the UAC prompt.

 

cd-latest.png

What switches does it use ?

By opening that location with a command prompt and typing the following command:

ContentLibraryCleanup.exe /?

you can see the following output:

 

Usage: ContentLibraryCleanup.exe [/delete] [/q] /dp <Distribution Point FQDN> [/
ps <Primary Site FQDN> /sc <Primary Site Code>] [/log <log file directory>]

/delete (optional) — delete the content, do not print what would be deleted.
/q (optional) — run in quiet mode. Suppress all prompts (assuming delete mode) and do not open log file automatically.
/dp <Distribution Point FQDN> (required) — the FQDN of the target distribution point.
/ps <Primary Site FQDN> (optional*) — the FQDN of the primary site. *Required if the distribution point is on a secondary site.
/sc <Primary Site Code> (optional*) — the site code of the primary site. *Required if the distribution point is on a secondary site.
/log <log file directory> (optional) — the directory to place log files in. Can be a network share. If not specified, the temp folder is used.

 

Note: By using the /q switch, this also assumes you answer ‘a’ to deleting all found orphaned content in conjunction with /delete.

Testing the tool

So let’s test it.

 

Note: Make sure to login as a user with Full Administrative access to the distribution point and with the Full Administrator RBAC role (this version of the tool doesn’t check if you are in an ADSG, so make sure you are explicitly a Full Administrator).

 

Enter the following command (replace the FQDN in bold with your dp FQDN and replace the log folder location with your chosen location):

 

ContentLibraryCleanup.exe /dp cm02.windowsnoob.lab.local /log d:\ContentLibraryCleanupLogs

 

running-the-cmd-1.png

 

when prompted about what-if, answer y for yes.

 

tool-has-run.png

 

Notice that it tells you how much space it would have saved it you had run it in delete mode. Running the tool also automatically opens the logfile in CMTrace

 

log-file.png

 

and that log file will give you details about the following

  • Orphaned packages
  • Packages with invalid contents
  • Orphaned files
  • Bytes freed if the tool is run in delete mode
Using the /delete switch

Now that you are familiar with the tool it’s time to use it for what it was designed for, so we’ll add the /delete switch.

 

Note: In the example below, there is NO problem on the distribution point, so no space is available to be freed up.

 

Enter the following command, notice the /delete switch. Please replace the FQDN in bold with your distribution point FQDN and replace the log folder location with your chosen location:

 

ContentLibraryCleanup.exe /delete /dp cm02.windowsnoob.lab.local /log d:\ContentLibraryCleanupLogs

 

with-the-delete-switch.png

 

answer yes to see the results

 

delete-switch-ran.png

 

and you’ll get a dated log file with the details of what was freed on the dp in question

 

bytes-freed.png

 

As there was no problem on this dp, no space was freed.

Deleting Orphaned content

So the above shows what happens when there’s no problem on the dp, but what if there was one or more orphaned files or packages ?

 

Note: In the example below, there is a problem on the distribution point, so we can free up space.

 

Let’s see the results of that….in the first check we omit the /delete switch, to see that it correctly identifies the problem, and it does!

 

without-delete-switch-1.png

 

next, it opens the log file (which auto-opens)

 

identified-problem-1.png

 

Next, run the command again but this time add the /delete switch, the red downward pointing arrow points to the orphaned content and prompts you what to do with it…

 

delete-switch-ran-2.png

 

answering yes to the prompt will delete the orphaned content (or answer a to delete all),

 

deleting-content.png

 

and, now you can see a difference in the log file too…

 

delete-content-log-file.png

 

Result !

 

Hopefully this new improved tool will help you clean up any unwanted content on your distribution points, and it’s a great improvement and proves that UserVoice works !

 

thanks to Brandon @ Microsoft for answering my questions !

 

cheers !

niall

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.