Takeown command fails with Access Denied message

So you wanted to take ownership over some files and the Takeown command failed with 'Access Denied' message. You have already checked if the file is open by another user or some hung process. You are loged in with the user who has the highest possible privileges on the system. Well, almost… There is one more thing you can try - running Takeown command as a system account.The simpler way to do this is to download PsTools from Microsoft.

Unpack the archive, open an elevated CMD in that folder and run psexec

psexec -i -s -d cmd.exe

This will open a new CMD window (in the C:\WINDOWS\system32 folder) using a SYSTEM account (-s), in interactive mode (-i), and will not wait for the process to finish executing (-d)

In this new window, you can use Takeown to finish the job.

Takeown /F c:\folder\file.ext /A
icacls "c:\folder" /reset /t /q
icacls "c:\folder" /grant administrators:F /T

This will take ownership of the specified file, but it will set local Administrators group as the new owner.

Enter your comment:
122 -5 = 
  • windows/misc/takeown_fail.txt
  • Last modified: 2021/03/01 12:10
  • by