I'm operating on Windows 2012 R2, trying to use a batch file to manage my NTFS perms using icacls. The batch file is almost complete, then I'll be handing it off to someone with far less experience to manage, so I'm trying to make it as easy for him as possible.
I want to automatically REPLACE all perms on the drive root (E:), in case they have been modified. The entire drive will be restored to a known configuration. Then I will set a few perms at the root (administrator, backup, etc.) that will propagate thru inheritance to all subdirectories. (probably these 2 operations are the same icacls call) There are many subdirectories, and different permissions will be applied to each of them. I have the subdirectory part of the batch file complete and successful.
I have been unable to use icacls to REPLACE all permissions on the drive root. I have tried:
ICACLS.EXE "E:" /inheritance:r /grant:r "Administrators":(OI)(CI)F /T /Q
and
ICACLS.EXE "E:" /grant:r "Administrators":(OI)(CI)F /T /Q
both with no success. For testing, I added another group with access to the E:. After the batch file executed successfully to completion, that other group still had access; it was not removed from the ACL of the E:.
Any ideas?