I'm using a powershell script to create auditing in a windows directory and all of its subfolders.
$DrivePath = $args[0]
$AuditUser = "Everyone"
$AuditRules = "FullControl"
$InheritType = "ContainerInherit,ObjectInherit"
$AuditType = "Success,Failure"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAuditRule($AuditUser,$AuditRules,$InheritType,"None",$AuditType)
$ACL = Get-Acl $DrivePath
$ACL.SetAuditRule($AccessRule)
$ACL | Set-Acl $DrivePath
After running the script, the auditing is created for the root directory, but all of the subfolders have disabled the checkbox- "include inheritable auditing entries from this object's parent".
How can i use the script and keep the inheritance?