Access Denied using TakeOwn.exe

20

7

I have got this file that I can't delete. It happened after a system crash, so the CHKDSK kicked in upon next reboot. After that, I can't delete the file. THis is on Windows Home Server, and the file is one of those hidden Thumbs.db, and my WHS reports a "File conflict" on the file, the reason: Access Denied"

What I have tried so far, running as an Administrator:
Delete: Access Denied
TakeOwn.exe : Access Denied
Attrib.exe -s -h : Access Denied
cacls.exe : Access Denied (even whe trying to display the current owner)
Rename: File not found (its hidden)
Re-boot in to safe mode and tried the above: Access Denied
Running the above commands as Local System: Access Denied

Tizer Unlocker: Fail (Doesn't find anything locking the file)
File Assasin: Crashes ("FindRemoteFileHandles returned NULL value.")

I have used the CHKDSK /f again, rebooted since some suggestions is that the file has been corrupted, but that didn't change anything.
Any suggestions ?

Update: In a total separate scenario, I experienced a similar situation; Access Denied when trying to take ownership of a file. It turned out that the file was owned by TrustedInstaler, which is not possible to override just by being an Administrator. In this case, one can use psexec /ids cmd to elevate yourself to System and then TakeOwn.exe /a

Magnus

Posted 2010-04-12T05:46:10.707

Reputation: 978

1and when psexec then takeown ALSO results in an "access denied" ? How do I use process monitor to find this low level error? – frumbert – 2015-07-02T06:26:43.900

>

  • Who is the current owner of the file?
  • Are you sure you have the "take ownership" privilege?
  • Are you able to rename/move the file? (it might sound unlikely but try it!)
  • < – Hugh Allen – 2010-04-12T07:18:16.993

    @Hugh. 1. Can't be determined. CACLS.EXE gets Access Denied when trying to display owner. 2. I can't get any higher in the hierarchy than Administrator. 3. Rename can't find the file, since its hidden. – Magnus – 2010-04-12T19:14:58.337

    Have you tried using Process Monitor to see what the low-level error is? http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    – Hugh Allen – 2010-04-14T07:12:50.060

    (in Process Monitor, so as not to be overwhelmed with a flood of info, add an Include filter for "Path contains Thumbs.db". An Include filter excludes everything else.) – Hugh Allen – 2010-04-14T07:15:01.957

    I have a similar problem with a acouple of files I need to delete. I tried CACLS, ICALCS, and TakeOwn all running as Administrator and then System using psexec. I also tried Unlocker. Nothing has worked. – Fred – 2013-09-10T00:40:03.887

    Answers

    18

    I had the same problem earlier today and fixed it using Unlocker. I don't know if it's any different from the tool that Nicu Zecheru recommmended, but I thought I'd share it here for future reference.

    At first didn't believe that the folder could actually be locked, I restarted my PC several times since I first discovered that I am unable to access it, and none of these things worked:

    • chkdsk /f - scanned the disk but found nothing
    • takeown - access denied
    • fileacl /force - access denied
    • cacls.exe, xcacls.exe - no luck

    Unlocker found that Windows Media Player was locking the file. If I remember correctly, I did have a video file in that folder, but I don't think I ever tried to open it using WMP. I copied the folder from a network location initially, and it's possible WMP might have accessed it during its background library crawling.

    NOTE: it seems that older versions of Unlocker were bundled with adware (nothing nasty thought, some e-bay shortcuts from what I've seen). I simply unchecked these items during installation and everything was smooth.

    Groo

    Posted 2010-04-12T05:46:10.707

    Reputation: 996

    Well, I'll be darned. This software reported no issues and no locking handle found. However, it had an option to delete/rename/move the folder anyway, which I did. And that ugly file went away... poof. Thanks. – Magnus – 2010-07-17T12:06:15.117

    Same for me, it reported no locks, tried to delete it, could not, offered to schedule a delete on next system restart - and that did it. So I guess it was locked and owned by some system process. Of this is on Win10 by the way. – Alexander Abramov – 2017-01-21T17:50:38.210

    2That is crapware... Why dont use the better, standard and builtin resmon.exe?? Resource Monitor>CPU>Associate Handles>Search Handles> Write in the text field the name of the locked file or folder, and press, "Search". Voila. – Brethlosze – 2017-08-29T05:29:29.713

    @hyprfrcb: seems like a better option indeed, so add this as an answer, it's better than posting it as a comment. Perhaps OP can even accept is as the correct answer since mine is rather outdated. – Groo – 2017-08-29T08:18:47.100

    3

    I can't get any higher in the hierarchy than Administrator

    Sure you can. The local System account has higher privileges than Administrator. To start a command prompt under the System account, issue the command

    at (time) /interactive cmd.exe
    

    Where (time) is the current time plus 1 minute. Alternatively, download Sysinternals' PSTools and use

    psexec -i -s cmd.exe
    

    The elevated command prompt will start in a different directory from usual, which for me is

    C:\WINDOWS\system32>
    

    Hugh Allen

    Posted 2010-04-12T05:46:10.707

    Reputation: 8 620

    @Hugh. Nope, sorry Local System didn't do anything. Question updated. – Magnus – 2010-04-14T05:16:27.703

    0

    You can try using Tizer Unlocker (freeware)

    Here are some of the error messages that can be dealt with Tizer:

    The file is in use by another program or user. Cannot delete file: It is being used by another person or program. Cannot delete folder: It is being used by another person or program. Cannot delete file: Access denied. The source or destination file may be in use. The process cannot access the file because it is being used by another process. There has been a sharing violation. Close any programs that might be using the file and try again. Make sure the disk is not full or write-protected and that the file is not currently in use. Error deleting file or folder. Cannot delete file or folder: The file name you specified is not valid or too long. Specify a different file name.

    Nicu Zecheru

    Posted 2010-04-12T05:46:10.707

    Reputation: 5 234

    Thanks, but there is nothing locking the file. – Magnus – 2010-04-12T20:49:25.260

    -1

    A caution: If the file is in the Windows directory or somewhere sensible, be careful about deleting it.

    First, try booting in Safe mode to delete the file.

    Second, sometimes the file is locked by explorer.exe itself. To solve such a problem:

    1. In Safe mode, launch a Command Prompt (cmd) as administrator
    2. Navigate in cmd to the directory in question and enter (but do not execute) a "del" command for the file in question
    3. Use Task Manager to kill explorer.exe
    4. Quickly press Enter in the cmd window to delete the file, before Windows restarts explorer

    Third, the free utilities MoveOnBoot or Unlocker can be used to schedule delete of the file at boot time.

    harrymc

    Posted 2010-04-12T05:46:10.707

    Reputation: 306 093