Replace permission entries on all child objects using icacls

I'm trying to set Replace permission entries on all child objects using icacls but I can't seem to do it. I want new folders/files to receive the permissions as well so I want to check the box Replace all child object permissions with inheritable permissions from this object using icacls.
I thought /inheritance:e would do it that doesn't seem to to the trick.

I think I should be using (OI)(CI) but I'm unsure how to use them.

The command I'm using is:

icacls D:\UserShares /grant:r "Domain\Users":f "Domain\Admins":f /c /t /l /q

I have a script that traverses though the D: drive and resets the permissions on all subfolders using the above command but I also want to check the box Replace all child object permissions with inheritable permissions from this object on each. Any help much appreciated.


Want to reset NTFS permissions from the command line? Use this syntax:

icacls "c:\users\jshipp\*" /q /c /t /reset

This is the same as using the GUI command: Replace all child object permissions with inheritable permissions from this object

  • Win7: Replace all child object permissions with inheritable permissions from this object
  • WinXP: Replace permission entries on all child objects with entries shown here that apply to child objects

Warning: If you leave out the \* then the jshipp folder will have the same permissions as the users folder, which is not what the GUI does, and probably not what you want, but it's nice to know it's possible.

Disclaimer: This is a copy-paste answer from http://www.jshipp.com/articles/icacls/icacls.php I thought it was too helpful to not be an answer on Server Fault.