12

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>

22

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).
  • 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. – Andrew Brock Sep 27 '18 at 8:15
1

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

  • 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 '14 at 11:08
  • yes thank you for this I just this minute found it out haha – ThunderToes Sep 19 '14 at 11:08
1

Sorry Stupid question, but for future reference to other users, I used Takeown /? to find that I could write in CMD:

C:\Windows\System32>takeown /f K:\ /R

This then gave me permission to all folder and subfolders

If you use the takeown command or any command in CMD use /? to get the information on what features you can use and what they do.

Not the answer you're looking for? Browse other questions tagged or ask your own question.