Set-ACL Problems
Hi guys,
struggling with a little problem. I´m trying to add new a new ACL to an folder with subfolders.
Code:
$colRights = [System.Security.AccessControl.FileSystemRights]::ReadAndExecute
$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit `
-bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None
$objType =[System.Security.AccessControl.AccessControlType]::Allow
$objUser = New-Object System.Security.Principal.NTAccount($principal)
$objACE = New-Object System.Security.AccessControl.FileSystemAccessRule `
($objUser, $colRights, $InheritanceFlag, $PropagationFlag, $objType)
$objACL = Get-ACL $folderPath
$objACL.AddAccessRule($objACE)
Set-ACL $folderPath $objACL
The Problem:
some folders don´t get the new ACL although the Inheritance isn´t disabled on these folders.
If i manually add or edit the ACL on the root folder afterwards and confirm the changes-> all subfolders inherit the new ACL wich i set through the powershell command!?!?
Posted Jan 23, 2016, 4:48 PM UTC
Sorry, I'm mobile right now and I can't check, but your propagation flag is set to none. So it's not pushing the new ACL to child objects. You might be able to get away with removing that property for now.
could you tell me the difference between the inheritance and propagation flag? im going to test it with the propagation flag
tested with all variations of the propagation flag -> same result
Inherit comes from above. Propagate works its was down.