Problem

When trying to delete files from Windows, you are given an error message that the file cannot be deleted because it is in use, but you do not know what is currently using it.  

Resolution

To determine what is currently using the file(s):

1. Open 'Task Manager' and click on the Performance Tab. At the bottom of that menu, click the button to "Open Resource Monitor".

2. Within the 'Resource Monitor' click to the 'CPU' tab and then expand the 'Associated Handles' section. Within the search box for Associated Handles, type in the folder name, part of the path, or the full path to the files you are trying to delete. For Example: ADTEMP, TEMP/ADTEMP, or C:\Users\Administrator\AppData\Local\Temp\adtemp

3. The Search Results will show you what programs are currently using anything matching what you searched for. You can right click on the program currently using the file and choose to 'End Process' on that program. ProcessingHost, ADIndexer, ADProcessor, ADLoader, and INSOViewer are the common ones to hold items for us. NOTE: explorer.exe WILL NOT prevent something from being deleted. You do NOT need to 'End Process' for explorer.exe in this context.

4. Refresh the search and make sure the program no longer displays in the list, and then try to delete again. 

Cause

Recycle Services Script and the Clean up Tool do not stop the Processing Engine and work manager from trying to do their jobs. They interact with SQL to stop editing the database. This means that it is possible for the logs and temp files to still be in use by some of the work manager items even after all services have been stopped and all software closed.