Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How set "Include inheritable auditing entries from this object's parent" for a folder

$
0
0

Hi,

I'll like to request your help in order to find out a way to set the option "Include inheritable auditing entries from this object's parent" for a folder using powershell, I'm using this way "$ACL.SetAuditRuleProtection($false, $false) " but it is not working

Here is full script that I'm using to create a new folder and set the diferent options:

      $sam = "userneme"      

      New-Item -Name $sam -ItemType Directory -Path "path" | Out-Null      

      $ACL = Get-Acl "path"
      $ACL.SetAccessRuleProtection($false, $false) 
      $ACL.SetAuditRuleProtection($false, $false) 

      $ACL.Access | ForEach { [Void]$ACL.RemoveAccessRule($_) } 
      $ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("AD_group","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow"))) 
      $ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("domain\$sam","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))            
      Set-Acl "\\cr.aligntech.com\cr\Production\Production Spreadsheets\$sam" $ACL 

Regards.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>