How to replace permissions and everything inside with icacls on Windows Server 2012?
As mentionned is comments, you also have to use the
/inheritance:r switch to remove inherited permissions.
/grant:r only removes explicit permissions.
icacls c:\temp\test /inheritance:r /grant:r <DOMAIN>\<USER>:(OI)(CI)F /T
To also grant
icacls c:\temp\test /inheritance:r /grant:r <DOMAIN>\<USER>:(OI)(CI)F /grant:r SYSTEM:(OI)(CI)F /T
/grant:r didn't work for me. I had to use
/reset to revert permissions to inherintance only and then remove the inherited permissions. Don't forget to change subdirectories with