title: Inheritance of Permissions Powershell Script
body: <p>I am trying to create a script that will pass down inheritance of the subfolder.</p>
  <p>For example:</p>
  <pre><code>C:/template has x y z permissions
  C:/template/test only has x permissions
  </code></pre>
  <p>I want all sub folders and files from C:/template to get the x y z permissions.</p>
  <p>Something similar to the <a href="http://powershell.org/wp/forums/topic/replace-child-object-permissions-on-existing-folderssubfoldersfiles/" rel="nofollow noreferrer">script here</a>  that Robert Prust made (it does not execute):</p>
  <pre><code>$ACL = Get-Acl -Path C:\Template
  $Folders = Get-ChildItem -Recurse -Path &quot;C:\new_perm&quot; -Filter 'Subfolder*' | Select-Object -ExpandProperty FullName
  foreach ($Folder in $Folders) {
     # write the variables found - check if the folder path is correct
     # Write-Output &quot;This foldername is $Folder&quot;
     # convert foldername to a icacls approved path
     $icacls = &quot;$Folder\*&quot;
     # check if the icacls path is correct
     # Write-Output &quot;icacls path is $icacls&quot;
     #set the ACL required on the folder
     Set-ACL -Path $Folder -AclObject $ACL
     # replace all child permissions for the folder
     icacls $icacls /q /c /t /reset
  }
  </code></pre>
  <p>Thanks,</p>
  <p>Jonathan</p>