Force change the owner of all files and folders, subfolders under the current directory to the Administrators group (administrators) command:
TAKEOWN/F */A/R/D y
Modify the NTFS permissions for files and subfolders in all d:documents directories to only the Administrators group (administrators) Full Control (delete all existing NTFS permission settings):
cacls d:documents*.*/t/g Administrators:f
Add the Administrators group (administrators) Full Control permission on the NTFS permissions of files and subfolders in the original d:documents directory (do not delete all NTFS permission settings):
cacls d:documents*.*/t/e/g administrators:f
Remove Full Control permissions for the Administrators group (administrators) (Do not delete all NTFS permission settings):
cacls serverdocuments%username% My Documents/T/E/R "Mddqdomain admins"
cacls serverdocuments%username% Desktop/t/e/r "Mddqdomain admins"
With these two commands, you can achieve bulk capture of folders, file owner permissions, and the ability to add full control to the Administrators group.
C:documents and Settingsadministrator>takeown/?
Takeown [/S system [/u username [/p [password]]]
/f filename [/a] [/R [/d prompt]]
Describe:
This tool allows the administrator to regain access to previously denied accesses by reassigning file ownership
File access rights.
Parameter list:
/S system Specifies the remote system to connect to.
/u [domain]user Specifies the user context, the command executes in this context.
/p [Password] specifies the password for the given user context. If omitted,
Prompt for input.
/f filename Specifies the file name or directory name pattern. You can use the wildcard character "*"
Specifies the pattern. The share name file name is allowed.
/A assigns ownership to the Administrators group, not the current user.
/R recursion: Indicates that the tool is running in the specified directory and subdirectories
On the file.
/d Prompt the current user does not have a "list folder" in a directory
Permission, the default answer is used. When done in subdirectories
This happens when the recursive (/R) operation occurs. With effective
The value "Y" gets ownership or is skipped with "N".
/? Displays the help message.
Note: 1) If you specify/A, the file ownership is given to the user who is currently logged on.
2) Mixed mode with "?" and "*" is not supported.
3)/d is used to suppress the confirmation prompt.
Example:
Takeown/?
takeown/f Lostfile
takeown/f systemsharelostfile/a
takeown/f directory/r/d N
takeown/f DIRECTORY/R/A
TAKEOWN/F *
takeown/f C:windowssystem32acme.exe
takeown/f%windir%*.txt
TAKEOWN/S system/f Myshareacme*.doc
TAKEOWN/S system/u user/f MySharefoo.dll
TAKEOWN/S system/u domainuser/p password/f sharefilename
TAKEOWN/S system/u user/p password/f docreport.doc/a
TAKEOWN/S system/u user/p password/f myshare*
TAKEOWN/S system/u user/p password/f homelogon/r
TAKEOWN/S system/u user/p password/f mysharedirectory/r/A