Content Library Cleanup Tool - improve error handling
While using the Cleanup tool I've encountered a few occasions where it crashes out with file access errors. It crashes to the command prompt and all previous activity is lost as it doesn't get logged. Is it possible to improve the error handling of the tool that it logs access errors instead of throwing an exception? I've included a sample of the exception error message below.
System.IO.IOException: Access to the path '\mydistpoint.com.au\SCCMContentLib$\DataLib\Content_27822e98-f79a-436a-af07-fa88beac76c5.1\Templates' is denied.
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContent.Delete(Boolean whatIfMode, CLPackage fromPackage)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLPackage.Delete(Boolean whatIfMode)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.CleanupOrphanedPackages(Boolean whatIfMode, Boolean quietMode)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.CLContentLibrary.Cleanup(Boolean whatIfMode, Boolean quietMode, String logDir)
at Microsoft.ConfigurationManager.ContentLibraryCleanup.Program.Main(String args)
Chad Simmons commented