Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoPropagateInherit is not boolean but can be 0, 1 or 2 #20

Open
TorstenSchnitter opened this issue Sep 14, 2022 · 1 comment
Open

NoPropagateInherit is not boolean but can be 0, 1 or 2 #20

TorstenSchnitter opened this issue Sep 14, 2022 · 1 comment

Comments

@TorstenSchnitter
Copy link

Setting ace to 'ReadAndExecute' with 'SubfoldersOnly' and 'NoPropagateInherit' = $true
does not end in the correct result.
ACE in 'PropagationFlags' should be 'NoPropagateInherit, InheritOnly' but is 'NoPropagateInherit' only witch is not the correct result.
(the problem may be in File 'cNtfsPermissionEntry.psm1' at starting line 739)

cNtfsPermissionEntry ('[{0}]:Users' -f $Path) {
Ensure = 'Present'
Path = $Path
Principal = ('BUILTIN\Users')
AccessControlInformation = @(
cNtfsAccessControlInformation {
AccessControlType = 'Allow'
FileSystemRights = 'ReadAndExecute', 'Synchronize'
Inheritance = 'SubFoldersOnly'
NoPropagateInherit = $true
}
)
}

should result in:
FileSystemRights AccessControlType IdentityReference IsInherited InheritanceFlags PropagationFlags
---------------- ----------------- ----------------- ----------- ---------------- ----------------
ReadAndExecute, Synchronize Allow BUILTIN\Users False ContainerInherit NoPropagateInherit, InheritOnly

but really results in:
FileSystemRights AccessControlType IdentityReference IsInherited InheritanceFlags PropagationFlags
---------------- ----------------- ----------------- ----------- ---------------- ----------------
ReadAndExecute, Synchronize Allow BUILTIN\Users False ContainerInherit NoPropagateInherit

@TorstenSchnitter
Copy link
Author

function New-FileSystemAccessRule should be changed at line 739 from:
if ($NoPropagateInherit -eq $true -and $InheritanceFlags -ne 'None')
{
[System.Security.AccessControl.PropagationFlags]$PropagationFlags = 'NoPropagateInherit'
}

To:
if ($NoPropagateInherit -eq $true -and $InheritanceFlags -ne 'None')
{
if ($PropagationFlags -eq 'None')
{
[System.Security.AccessControl.PropagationFlags]$PropagationFlags = 'NoPropagateInherit'
}
else
{
[System.Security.AccessControl.PropagationFlags]$PropagationFlags = 'NoPropagateInherit', 'InheritOnly'
}
}

This does solve the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant