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?
Windows – takeown /R not applying to hidden files
batch filecommand linefile-permissionswindows server 2008
Best Answer
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 usingtakeown
.Something to the effect of
icacls <directory name> /grant <your username>:F /t
.