Content Library Cleanup - System.NullReferenceException: Object reference not set to an instance of

%3CLINGO-SUB%20id%3D%22lingo-sub-1806510%22%20slang%3D%22en-US%22%3EContent%20Library%20Cleanup%20-%20System.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1806510%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%3CSTRONG%3EShort%20Story%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Ewe%20use%20a%20single%20server%20to%20host%20everything%20MECM.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20content%20library%20has%20a%20heap%20of%20entries%20that%20are%20greyed%20out%20and%20the%20majority%20of%20the%20entries%20appear%20to%20be%20from%205%2B%20years%20ago%20for%20deployments%20we%20no%20longer%20have.%3C%2FP%3E%3CP%3EHow%20do%20I%20clean%20out%20all%20the%20invalid%20entries%20from%20content%20library%20explorer%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3Ethe%20Details%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%20I%20tried%20running%20the%20tool%20contentlibrarycleanup.exe%20in%20whatif%20mode%2C%20but%20after%20running%20for%20about%20an%20hour%2C%20it%20ends%20with%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAnalyzing%20local%20files%2C%20100.00%25%20complete...%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ELoading%20package%20data%20from%20provider...%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ELoading%20local%20package%20data...%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ELoading%20distributed%20packages%20from%20provider...%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ESystem.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%20of%20an%20object.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Eat%20Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.LoadOrphanData(Boolean%20whatIfMode)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Eat%20Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Cleanup(Boolean%20whatIfMode%2C%20Boolean%20quietMode%2C%20String%20logDir)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3Eat%20Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String%5B%5D%20args)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eour%20environment%20is%20server%202019%2C%20sql%202019%2C%20MECM%202002%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20found%20this%20document%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fcore%2Fplan-design%2Fhierarchy%2Fcontent-library-cleanup-tool%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fcore%2Fplan-design%2Fhierarchy%2Fcontent-library-cleanup-tool%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eit%20has%20this%20entry%20which%20is%20a%20bit%20vague%2C%20saying%20it%20will%20cleanup%20the%20DP%20but%20not%20if%20the%20DP%20is%20on%20a%20site%20server%3F%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22The%20tool%20only%20affects%20the%20content%20on%20the%20distribution%20point%20that%20you%20specify%20when%20you%20run%20the%20tool.%20The%20tool%20can't%20remove%20content%20from%20the%20content%20library%20on%20the%20site%20server.%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20way%20I%20read%20this%20is%20a%20little%20vague%2C%20but%20it%20suggests%20to%20me%20that%20maybe%2C%20if%20you%20have%20a%20single%20primary%20Site%20server%20that%20also%20contains%20your%20DP%2C%20this%20tool%20is%20not%20able%20to%20assist%20with%20cleaning%20up%20the%20DP%20of%20invalid%20content.%20Is%20that%20correct%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20another%20option%20for%20this%20scenario%20if%20the%20tool%20doesn't%20support%20a%20single%20DP%20on%20the%20site%20server%3F%3C%2FP%3E%3CP%3EHow%20do%20I%20get%20rid%20of%20all%20the%20invalid%20entries%20in%20my%20content%20library%20explorer%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1806510%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECM%20current%20branch%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1806845%22%20slang%3D%22en-US%22%3ERe%3A%20Content%20Library%20Cleanup%20-%20System.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1806845%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F304933%22%20target%3D%22_blank%22%3E%40PaulKlerkx%3C%2FA%3E%26nbsp%3BI%20attached%20an%20example%20of%20what%20I%20am%20talking%20about%20re%20orphaned%20files%2C%20showing%20one%20being%20an%20old%20office%20deployment.%26nbsp%3B%20On%20this%20page%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.reddit.com%2Fr%2FSCCM%2Fcomments%2Fdcwutx%2Fcontent_library_cleanup_tool_orphaned_content%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.reddit.com%2Fr%2FSCCM%2Fcomments%2Fdcwutx%2Fcontent_library_cleanup_tool_orphaned_content%2F%3C%2FA%3E%3B%26nbsp%3B%20Jason%20Sandys%20states%20the%20following%2C%26nbsp%3B%3CSPAN%3Ebut%20if%20they%20aren't%20orphaned%2C%20what%20are%20they%3F%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%22It's%20not%20possible%20to%20have%20orphaned%20content%20in%20the%20site%20server's%20content%20library.%20Orphaned%20content%20happens%20in%20remote%20content%20libraries%20when%20content%20is%20not%20properly%20cleaned%20up%20because%20of%20one%20of%20a%20handful%20of%20reasons%20like%20connectivity%20loss.%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ethis%20page%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fcore%2Fsupport%2Fcontent-library-explorer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fcore%2Fsupport%2Fcontent-library-explorer%3C%2FA%3E%26nbsp%3Bsuggests%20they%20can%20only%20be%203%20things%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3EThe%20package%20is%20the%20Configuration%20Manager%20client%20upgrade.%20This%20package%20includes%20%22ccmsetup.exe%22.%20(DEFINITELY%20NOT%20THIS%20-%20that%20is%20there%20too%20but%20appears%20as%20%22INVALID%22%20and%20different%20to%20the%20ones%20with%20asterixis%20)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EYour%20user%20account%20can't%20access%20the%20package%2C%20likely%20due%20to%20role-based%20administration.%20For%20instance%2C%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApplication%20Author%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Erole%20can't%20see%20driver%20packages%20in%20the%20console%2C%20so%20any%20driver%20packages%20on%20the%20distribution%20point%20are%20marked%20as%20disabled.%20(NOT%20THIS%20-%20I%20AM%20MECM%20AND%20SERVER%20FULL%20ADMIN%20and%20have%20been%20for%20over%2010%20years)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EThe%20package%20is%20orphaned%20on%20the%20distribution%20point.%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CH3%20id%3D%22toc-hId-1282137195%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%20id%3D%22toc-hId-1282137223%22%3E%26nbsp%3B%3C%2FH3%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1817044%22%20slang%3D%22en-US%22%3ERe%3A%20Content%20Library%20Cleanup%20-%20System.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1817044%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241578%22%20target%3D%22_blank%22%3E%40Michiel%20Overweel%3C%2FA%3E%26nbsp%3Bthanks%2C%20I'll%20log%20a%20support%20case.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1817288%22%20slang%3D%22en-US%22%3ERe%3A%20Content%20Library%20Cleanup%20-%20System.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1817288%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241578%22%20target%3D%22_blank%22%3E%40Michiel%20Overweel%3C%2FA%3E%26nbsp%3B%40%26nbsp%3BI%20logged%20a%20case%20with%20Microsoft%20and%20the%20tech%20went%20straight%20to%20the%20document%20I%20mentioned%20above%20that%20says%20the%20cleaner%20tool%20doesn't%20work%20when%20co-located%20on%20the%20site%20server%20and%20said%20it%20wouldn't%20work.%26nbsp%3B%20He%20is%20escalating%20to%20see%20if%20we%20have%20any%20other%20options%20for%20cleaning%20out%20the%20orphaned%20entries.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1818508%22%20slang%3D%22en-US%22%3ERe%3A%20Content%20Library%20Cleanup%20-%20System.NullReferenceException%3A%20Object%20reference%20not%20set%20to%20an%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1818508%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F304933%22%20target%3D%22_blank%22%3E%40PaulKlerkx%3C%2FA%3E%26nbsp%3BI%20would%20disagree%20with%20that%20statement...%20I%20am%20able%20to%20run%20the%20tool%20against%20my%20co-located%20site%20server%2Fdistribution%20point%20content%20library%20just%20fine.%20As%20a%20matter%20of%20fact%2C%20when%20I%20tried%20last%20week%2C%20it%20successfully%20deleted%20about%206%20GB%20worth%20of%20orphaned%20software%20update-related%20content.%20Having%20said%20that%2C%20I%20also%20have%20a%20couple%20of%20these%20disabled%20(greyed-out)%20packages%20in%20my%20library%2C%20just%20like%20you%20do%2C%20and%20these%20weren't%20deleted.%20However%2C%20I%20didn't%20run%20into%20the%20error%20that%20you%20experienced%20either.%20In%20my%20opinion%2C%20even%20though%20it%20might%20not%20fix%20your%20problem%2C%20you%20should%20be%20able%20to%20run%20the%20tool%20successfully%20nevertheless.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

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-to...

 

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?

 

12 Replies

@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.

 

@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.

@Michiel Overweel @ I logged a case with Microsoft and the tech went straight to the document I mentioned above that says the cleaner tool doesn't work when co-located on the site server and said it wouldn't work.  He is escalating to see if we have any other options for cleaning out the orphaned entries.  

@PaulKlerkx I would disagree with that statement... I am able to run the tool against my co-located site server/distribution point content library just fine. As a matter of fact, when I tried last week, it successfully deleted about 6 GB worth of orphaned software update-related content. Having said that, I also have a couple of these disabled (greyed-out) packages in my library, just like you do, and these weren't deleted. However, I didn't run into the error that you experienced either. In my opinion, even though it might not fix your problem, you should be able to run the tool successfully nevertheless.

@Michiel Overweel just a quick update that I haven't given up on this, I'm still waiting for a MS tech to get back to me about my support call. no progress on this so far.  I'll post back here when that happens.  

@Michiel Overweel - MS called this afternoon while I was grabbing a drink so I missed it.  I did a bit of a read through the doco on contentlibrarycleanup and found there is an option for a log file.  initially I figured that would just return what is shown in the cmd window, however for me it came back with one line. 

 

"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."

 

I don't understand that, in what situation would I correctly have a package in the content library that isn't distributed to a DP.  

 

I also figured out that if I locate the package ID referenced in content library explorer for a greyed out app, then look that up in content status, that will give me the app name.  If I then go and delete that application, that will remove it from content status in the console, however the greyed out entry remains in content library explorer so now I have an entry in content library explorer for an application that doesn't exist anywhere in my console.  I did a count too, I have 152 greyed out entries in content library explorer.  

@PaulKlerkx Interested if you get an update on this as I'm running into the same exact issue.

@Nick-86 , I got this from MS yesterday, will post results back here when available -

"Please be informed I will update you within next couple of days with an appropriate details for the case."

@Nick-86 - one other thing I found was that if I attempt to export an application from the console, I get a similiar message

"System.NullReferenceException
Object reference not set to an instance of an object."

 

I'm unsure if it is related, but being the same message, I'm now wondering if maybe there is a MECM dependency ( E.G. dotnet or WMI) that has a problem which is causing my issues.  

@PaulKlerkx Haven't tried to export an application but I can try that tomorrow when I log back in.

 

I'm currently trying to deal with an issue where my ADR for Windows 10 updates is creating thousands of content folders when it says there are only 433 updates. A lot of them look to be different languages so not sure if that's all it is but it's mind boggling. Need to get a handle on ADR best practices.

@Nick-86 your "issue" may actually be expected behaviour - https://docs.microsoft.com/en-us/answers/questions/139391/high-number-of-definition-updates-in-deplo... - our Win10 ADR deployment package contains 49 items, SUG has 12 updates and our ADR content folder has 371 directories.