Win_acl permission inheritance child objects

you are correct @mikemorency, it worked when trying on some newly generated file structures.

so the workaround for IIS folder structure is:

  ansible.windows.win_powershell:
    script: |
        $l = Get-ChildItem -Path C:\inetpub\logs\LogFiles -Recurse -Directory -Force -ErrorAction SilentlyContinue | Select-Object FullName
        $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("xxxxxxxxx","ReadAndExecute","3","0","Allow") #FullControl

        foreach ($d in $l) {
            $ACL = Get-Acl -Path $d.FullName
            $ACL.SetAccessRule($AccessRule)
            $ACL | Set-Acl -Path $d.FullName
            }

thanks for taking time to comment!

2 Likes