Forum Discussion
Content Library Cleanup - System.NullReferenceException: Object reference not set to an instance of
Hi,
Short Story
we use a single server to host everything MECM.
Our content library has a heap of entries that are greyed out and the majority of the entries appear to be from 5+ years ago for deployments we no longer have.
How do I clean out all the invalid entries from content library explorer
the Details
I tried running the tool contentlibrarycleanup.exe in whatif mode, but after running for about an hour, it ends with this
Analyzing local files, 100.00% complete...
Loading package data from provider...
Loading local package data...
Loading distributed packages from provider...
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.LoadOrphanData(Boolean whatIfMode)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Cleanup(Boolean whatIfMode, Boolean quietMode, String logDir)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String[] args)
our environment is server 2019, sql 2019, MECM 2002
I found this document - https://docs.microsoft.com/en-us/mem/configmgr/core/plan-design/hierarchy/content-library-cleanup-tool
it has this entry which is a bit vague, saying it will cleanup the DP but not if the DP is on a site server??
"The tool only affects the content on the distribution point that you specify when you run the tool. The tool can't remove content from the content library on the site server."
the way I read this is a little vague, but it suggests to me that maybe, if you have a single primary Site server that also contains your DP, this tool is not able to assist with cleaning up the DP of invalid content. Is that correct?
Is there another option for this scenario if the tool doesn't support a single DP on the site server?
How do I get rid of all the invalid entries in my content library explorer?
- Short story
- According to Microsoft Support, the content Library cleanup tool logs and from my experience, the Content Library Cleanup Tool Does not work for a single server set up. (or single server with CMG)
- Greyed out entries in Content Library explorer indicate EITHER MECM having a record of content in the Database, but there isn't any content actually there in the content library OR the applications are retired.
After going through all this, I located a script that assisted with retiring some of our applications which took me several weeks to get the way I liked and run for each application. Part of the script is to rename the application which made it very easy to identify them in the content library explorer.
I still get the error message when running content library cleanup tool with the message in the logfile being "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."
What I found when running my retirement script is that a large number of our retired applications didn't have content on the DP's or DPG's and the original content had also been deleted or moved. I believe our move to a restored server highlighted these issues in the content library explorer and by running my script which cleans any content from the Dp's and DPG's as well as updating the content path, this has cleared up most of the issues being seen.
- PaulKlerkxIron Contributor
PaulKlerkx I attached an example of what I am talking about re orphaned files, showing one being an old office deployment. On this page; https://www.reddit.com/r/SCCM/comments/dcwutx/content_library_cleanup_tool_orphaned_content/; Jason Sandys states the following, but if they aren't orphaned, what are they?
"It's not possible to have orphaned content in the site server's content library. Orphaned content happens in remote content libraries when content is not properly cleaned up because of one of a handful of reasons like connectivity loss."
this page - https://docs.microsoft.com/en-us/mem/configmgr/core/support/content-library-explorer suggests they can only be 3 things
The package is the Configuration Manager client upgrade. This package includes "ccmsetup.exe". (DEFINITELY NOT THIS - that is there too but appears as "INVALID" and different to the ones with asterixis )
Your user account can't access the package, likely due to role-based administration. For instance, the Application Author role can't see driver packages in the console, so any driver packages on the distribution point are marked as disabled. (NOT THIS - I AM MECM AND SERVER FULL ADMIN and have been for over 10 years)
The package is orphaned on the distribution point.
- Michiel OverweelMicrosoft
PaulKlerkx Even with the DP role co-located on the site server, you should still be able to run the Content Library Cleanup Tool against it. You may be hitting a bug here. I'd suggest raising a support request with Microsoft to make sure.
- PaulKlerkxIron Contributor
Michiel Overweel thanks, I'll log a support case.