Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
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
    
Worked great! Thanks for your help. –  Dave Nov 1 '12 at 13:38
    
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 '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!! –  MarqueIV May 13 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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