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?
Asked
Active
Viewed 5,140 times
2
Dave
- 197
- 1
- 4
- 6
1 Answers
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.
Ƭᴇcʜιᴇ007
- 111,883
- 19
- 201
- 268
-
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 '12 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. :) – Ƭᴇcʜιᴇ007 Oct 31 '12 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 01 '12 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!! – Mark A. Donohoe May 13 '14 at 16:30