15
5
I'm a developer and as part of the build process, a Microsoft dll is copied to a certain folder. That file copy is now failing as the target can't be overwritten.
I decided to delete it by hand (using an admin account but a non-elevated explorer) so browsed to the folder and attempted a delete. This failed (Require permission from the Administrator). The same applies when using an elevated explorer.
So I tried Properties->Security->Advanced->Ownership
The current owner is showing as Unable to display current owner
. I can't take ownership (a simple Access Denied
message with no elaboration). Elevated Command Prompt/PowerShell don't help either (both give an Access Denied
in their own way).
Process explorer shows no open handles on the file.
Eventually, I booted to linux and deleted the file but what I'd like to know is what caused it?
Security Essentials had no issues with the file. It's digitally signed by MS and the signatures match.
I encountered the same problem. In my case I found the root cause -- when I wanted to delete the folder, my git Bash was open and its working directory was that folder. When I changed the git Bash's working directory, the folder was deleted successfully. – Hong – 2016-01-25T02:31:38.457
possible duplicate of File I can't take ownership of
– CharlieRB – 2012-10-16T14:12:44.767@CharlieRB I've read it - but as you can see, my problem isn't removing the file but understanding what the "loss of ownership" is caused by. – Basic – 2012-10-16T14:23:19.413
You are right. Sorry. Guess I got lost in reading it and misunderstood the question. – CharlieRB – 2012-10-16T14:35:04.583
In some cases, deleting a file needs to be done externally, e.g. Safe Mode, or as you did booting into another OS. If the file has certain attributes (I'm not exactly sure but I think System affects it), along with the existing SYSTEM permissions, that makes it untouchable in the context of the booted Windows. Obviously once you go away from that context, it becomes irrelevant, but inside Windows 7 (and 8) some files are certainly undeletable. – None – 2012-10-16T16:05:27.793
@RandolphWest Thanks for the answer. Can you explain a little more? I know anything with an open handle can't be modified but suspect that if I deleted everything I could in my windows dir then rebooted, I'd have bricked my machine - so there's no "required for windows" flag set on a lot of files. Pagefile/etc come under the heading of open handles. I just don't see how a DLL buried in a folder on my D drive which has been replaced every few hours for days can suddenly be flagged as undeletable (nor what that "flag" is?) – Basic – 2012-10-16T16:39:28.950
It's not about open handles. I suspect Microsoft has an undocumented protection on certain files. If you can elevate to SYSTEM user, you might be able to delete the file that way, but yes, it's probably to do with protecting the system integrity. I've not researched this at all - I just know certain files need to be removed in either Safe Mode, or from an external OS. – None – 2012-10-16T18:34:14.697