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

PowerShell core does support calling ‘GetAccessControl’ #56

Open
mattyt0406 opened this issue Feb 11, 2020 · 2 comments
Open

PowerShell core does support calling ‘GetAccessControl’ #56

mattyt0406 opened this issue Feb 11, 2020 · 2 comments

Comments

@mattyt0406
Copy link

Change code in NTFLAccessEntry.psm1 file:
Proposed Solution:- to make the resource compatible with PowerShell core. We should replace the GetAccessControl method calls with ‘Get-Acl’ cmdlet
existing: $currentAcl = $fileSystemItem.GetAccessControl('Access')
new: $currentAcl = Get-ACL $fileSystemItem

@mattyt0406
Copy link
Author

but does it? if that change is made in the psm for ACL it works? does that change the way that data is returned?

@bcwilhite
Copy link
Collaborator

@mattyt0406 The reason that we moved away from Get-Acl is due to the AccessControl mask that Get-Acl uses ("15"/"All"). There are instances where that cmdlet also stores the owner and when using it to set an Acl where the owner cannot change the resource will throw an error. So to fix this issue, we used the GetAccessControl method with the "2" / "Access" option so that the owner information isn't stored.
https://docs.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.accesscontrolsections?view=netframework-4.8

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

2 participants