icacls Command for share Permission

Share Drive - Inheritance command to disable and enable

icacls "C:\demo\example" /inheritance:e /T

   /inheritance:e|d|r
          e - Enable inheritance
          d - Disable inheritance and copy the ACEs
          r - Remove all inherited ACEs

   /T  Traverse all subfolders to match files/directories. This will apply permission changes to
       all subfolders whether or not they are set to inherit permissions from the parent. On very large
       directory structures this may take some time as the command has to traverse the entire tree.


To list the permission for the folder via cmd:
>c:\test>icacls einheritance
einheritance NT AUTHORITY\SYSTEM:(OI)(CI)(F)
    BUILTIN\Administrators:(OI)(CI)(F)
    BUILTIN\Administrators:(I)(OI)(CI)(F)
    NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
    BUILTIN\Users:(I)(OI)(CI)(RX)
    NT AUTHORITY\Authenticated Users:(I)(M)
    NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

Successfully processed 1 files; Failed processing 0 files

>c:\test>

Comments