If the issue is a veto on a query for removal, you can look for which application has the reference on SetupApi logs. Oh.exe, or Process Explorer may also help to identify the process that’s causing the lock. Here’re some resources:
SetupApi Logs: SetupApi is a system component that device installation software can use to perform custom operations. By enabling SetupApi logs, you can check which process has a reference to the device.
Open Handlers: Oh.exe (Open Handlers) is a command line tool that can be downloaded for free with Windows Server Resource Kit Tools. This command-line tool shows the handles of all open windows and information relating to a particular process, object type, or object name.
Process Explorer: Process Explorer is an application that shows you information on which handlers or DLLs each process has opened.
Links: Download Process Explorer
- Know which process has locked a file, by Ramesh Srinivasan, MVP
- The case of the Mysterious Driver, by Mark Russinovich, MSFT
- SetupApi Logging, MSDN documentation
- Read the thread in Microsoft Communities on USB safe removal