Take Ownership of Files and Folders In Windows 10



Perhaps you've installed a new Windows 10 installation on your PC or maybe you're trying to recover some data from an old hard drive, it's likely in either of these scenarios that you may encounter an error message telling you that you don't have permission to access that folder.

If you are facing this error, there are a couple of things we can do to gain access to the files again.

Some of the error messages you may see include:

  • You don't currently have permission to access this folder.
  • Click Continue to permanently get access to this folder.
  • You have been denied permission to access this folder.
  • To gain access to this folder you will need to use the security tab.


How to fix "You don't currently have permission to access this folder."


To gain access to the files again you can right click on the file, go to properties, security, advanced, and change the owner of the file, then click ok and select all of your security permissions from the security tab, however this can be extremely repetitive and tedious if you are doing this for multiple files.

To make the process easier we can use the command line or PowerShell to run commands that will complete these tasks for us much more quickly, using the command-line also allows us to run the commands with the option to also take ownership and set security settings for all files and folders inside of your selected folder.

I have created a script that utilizes the following two commands which will set the security settings and take ownership of the file that you specify.

takeown - Allows you to take ownership of a file or folder
icacls - Applies security permissions to files and folders




Take Ownership Script


The take ownership PowerShell scripts that I have put together makes it easy to set the permissions and take ownership of files and folders on your device. this script will also set the security settings for all files or folders inside of the folder that you select.

When you run The script all you need to do is specify the desired username (to take ownership of the file with as well as apply full control permissions), and the file or folder path.

Once you have provided these details the script will get to work taking ownership of all files and folders you've specified and applying full control security permissions.

Note that this script needs to be run as an administrator, when you run this script it will automatically ask you for elevation and run the script as an administrator.

You can download the script from the following link

https://drive.google.com/file/d/1ioqfuwMojhE41c2MfXmUUJ76dqkVUxbY/view?usp=drivesdk

Microsoft Accounts

If you are using a Microsoft account on your computer, you may be able to find out what your username is by opening PowerShell and running the following command, Get-LocalUsers

Was this helpful?

Yes No


Comments

  1. How the hell do I use this? I just upgraded to windows 10 from windows 7. I don't get all of this power shell stuff. All I see is a notepad with stuff on it when I open your "tool".

    ReplyDelete
    Replies
    1. Hi there,

      Sorry for the late reply, you can run PowerShell scripts by right clicking on the .PS1 file and then clicking "Run with PowerShell"

      If you are signed in with a Microsoft account and need to get your username, you can first go to your start menu, type PowerShell, and then type the command Get-LocalUsers

      Hope this helps

      Delete
  2. Make it an app or a .bat file, I know how to use those.

    ReplyDelete

Post a Comment