mcollera / AccessControlDsc

MIT License
13 stars 12 forks source link

PowerShell core does support calling ‘GetAccessControl’ #56

Open mattyt0406 opened 4 years ago

mattyt0406 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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