2

I'm running a batch command to take ownership of a set of user folders and I'm finding that the ownership is not being pushed down to hidden files, such as ~normal.dot I'm using the following command: takeown /R /A /D Y /F D:\folderpath\username I don't see errors in the output, but when I try to robocopy that directory, I get access denied on such files. I find that I have to manually go to file properties > Security > Advanced > Edit (server 2008) > Replace all existing inheritable permissions on all descendants with inhabitable permissions from this object. Is there a way to make sure that I can move the folder after I've taken ownership of it?

1 Answer 1

6

Sounds like you took ownership with Takeown, but didn't give yourself read/write permissions (which is why you had to edit them via the GUI afterwards).

To do that from the command line you'd use icacls after using takeown.

Something to the effect of icacls <directory name> /grant <your username>:F /t.

4
  • After running the takeown command with the /A switch, administrators are automatically added to the ACL of the folder, just not the hidden files. Do I still need to run the icacls command?
    – Dave
    Oct 31, 2012 at 13:01
  • 1
    /A makes the Administrators group the owner instead of you. Remember, just because you own it doesn't mean you have write permissions. :) Oct 31, 2012 at 13:05
  • Sorry to bug again, however even after running icacls, I still received access is denied on hidden files that begin with ~. Any ideas?
    – Dave
    Nov 1, 2012 at 16:13
  • Thank god for this answer!!! I've been pulling my hair out for hours trying to figure out how I can be the owner, yet have no access to delete a file! Sure enough, I didn't have read/write permissions and once I granted them, the file went the way of the dodo! Thanks again for this answer!! May 13, 2014 at 16:30

You must log in to answer this question.

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