24

I have a hard drive which I need to recover specific files from but all the folders in the K:\ drive are denying me access even though I took owner ship of the full drive I.E

C:\Windows\System32>takeown /F K:\ This granted me access to the drive and see the folders but I can not access any of the folders after that.

Is there a way in which I can use Takeown to apply ownership to every directory on the drive>

2 Answers 2

43

Is there a way in which I can use takeown to apply ownership to every directory on the drive?

This can be done in two different ways, using takeown or icacls.


Take Ownership of an Object using takeown Command

This command will take ownership of the folder or drive, and all files and subfolders in the folder or drive.

Open an elevated command prompt (administrator).

To grant ownership to administrators group:

takeown /F "full path of folder or drive" /A /R /D Y

To Take Ownership of a Folder or Drive and All Contents using icacls Command

Open an elevated command prompt (administrator).

To set administrators group as owner:

icacls "full path of folder or drive" /setowner "Administrators" /T /C

Further Reading

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • icacls - Change file and folder permissions - display or modify Access Control Lists (ACLs) for files and folders.
  • takeown - Take ownership of a file (Windows 2003/7/2008).
3
  • 1
    This worked for me, but I had to do it from a system level prompt. Running from a cmd.exe as Administrator was not enough. To do that, I first had to run psexec -i -s cmd.exe from an Administrator command prompt, then run the commands from this answer. Sep 27, 2018 at 8:15
  • Windows tells me "'psexec' is not recognized as an internal or external command, operable program or batch file.". May 21, 2020 at 19:52
  • 2
    @NarftheMouse PsExec - Windows Sysinternals | Microsoft Docs
    – DavidPostill
    May 21, 2020 at 19:55
3

You will need to add a /R on your command to recurse throughout the subfolders and files...

2
  • Remembering also that the NTFS permissions also come in to affect once you are the owner.. If the NTFS permissions does not allow access to the creator/owner then it will make no difference being the owner...
    – CharlesH
    Sep 19, 2014 at 11:08
  • yes thank you for this I just this minute found it out haha Sep 19, 2014 at 11:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .