title: SET-ACL folder permissions not applying correctly with my PowerShell script
body: <p>I have two scripts: the first one creates a new root folder, and the second one creates a new child folder.</p>
  
  <p>It is MOSTLY working correctly, but when the inherited permissions are pulled down to the child folder the permissions don't show on the Security tab. However, if I check Advanced the permissions are showing correctly...</p>
  
  <p>This seems to be causing issues since the inherited permissions don't seem to be applying to the folder correctly.</p>
  
  <p>What am I doing wrong? 
  To clarify with an image:</p>
  
  <p><a href="https://i.stack.imgur.com/Kcu1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kcu1q.png" alt="This is what is showing"></a></p>
  
  <p>Here are my two scripts: </p>
  
  <p>Root/Parent Folder Creation: </p>
  
  <pre><code>    # Create initial ACE
      # Create the initial Object
      # Set domain - This could also be changed to prompt for domain if we decide it is needed
      # Define local Administrators group by Well Known SID
      # Set additional ACEs for the new AD File Share Groups
      # Set ACLs on the new folder
  function New-Ace {
    [CmdletBinding()]
    Param(
      [Parameter(Mandatory=$true, Position=0)]
      [Security.Principal.NTAccount]$Account,
      [Parameter(Mandatory=$false, Position=1)]
      [Security.AccessControl.FileSystemRights]$Permissions = 'ReadAndExecute',
      [Parameter(Mandatory=$false, Position=2)]
      [Security.AccessControl.InheritanceFlags]$InheritanceFlags = 'ContainerInherit,ObjectInherit',
      [Parameter(Mandatory=$false, Position=3)]
      [Security.AccessControl.PropagationFlags]$PropagationFlags = 'NoPropagateInherit',
      [Parameter(Mandatory=$false, Position=4)]
      [Security.AccessControl.AccessControlType]$Type = 'Allow'
    )
  
    New-Object Security.AccessControl.FileSystemAccessRule(
      $Account, $Permissions, $InheritanceFlags, $PropagationFlags, $Type
    )
  }
  
  $domain = 'ESG.INTL'
  $administrators = ([wmi]"Win32_Sid.Sid='S-1-5-32-544'").AccountName
  $ADDomainUsers = "$domain\Domain Users"
  
  $acl = Get-Acl $path
  
  $administrators, "$domain\Domain Admins" | ForEach-Object {
    $acl.AddAccessRule((New-Ace $_ 'FullControl'))
  }
  $acl.AddAccessRule((New-Ace $ADNameRW 'Modify'))
  $acl.AddAccessRule((New-Ace $ADNameRO 'ReadAndExecute'))
  $acl.AddAccessRule((New-Ace $ADDomainUsers 'ReadAndExecute'))
  
  $acl.SetAccessRuleProtection($true, $false)
  
  Set-Acl $path $acl
  </code></pre>
  
  <p>Child Folder Creation:</p>
  
  <pre><code>    # Create initial ACE
      # Create the initial Object
      # Set domain - This could also be changed to prompt for domain if we decide it is needed
      # Define local Administrators group by Well Known SID
      # Set additional ACEs for the new AD File Share Groups
      # Set ACLs on the new folder
  function New-Ace {
    [CmdletBinding()]
    Param(
      [Parameter(Mandatory=$true, Position=0)]
      [Security.Principal.NTAccount]$Account,
      [Parameter(Mandatory=$false, Position=1)]
      [Security.AccessControl.FileSystemRights]$Permissions = 'ReadAndExecute',
      [Parameter(Mandatory=$false, Position=2)]
      [Security.AccessControl.InheritanceFlags]$InheritanceFlags = 'ContainerInherit,ObjectInherit',
      [Parameter(Mandatory=$false, Position=3)]
      [Security.AccessControl.PropagationFlags]$PropagationFlags = 'NoPropagateInherit',
      [Parameter(Mandatory=$false, Position=4)]
      [Security.AccessControl.AccessControlType]$Type = 'Allow'
    )
  
    New-Object Security.AccessControl.FileSystemAccessRule(
      $Account, $Permissions, $InheritanceFlags, $PropagationFlags, $Type
    )
  }
  
  $acl = Get-Acl $path
  
  $acl.AddAccessRule((New-Ace $ADNameRW 'Modify'))
  $acl.AddAccessRule((New-Ace $ADNameRO 'ReadAndExecute'))
  
  
  Set-Acl $path $acl
  </code></pre>