$Acl =Get-Acl
$AclPath$AclAccess=$Acl.Access | Where-Object {!$_.IsInherited }
The above code returns permissions like
NT AUTHORITY\Authenticated Users Allow Modify, Synchronize
NT AUTHORITY\Authenticated Users Allow -536805376
When I attempt to copy the ACL from one folder to another using Get-Acl .Access and FileSystemAccessRule with Set-Acl, most permission work, but it always errors on numerical values like the one above.
New-Object : Exception calling ".ctor" with "5" argument(s): "The value '-536805376' is not valid for this usage of the type FileSystemRights.
Parameter name: fileSystemRights"
At C:\Replace-LocalGroups.ps1:57 char:26
+ $AccessRule = New-Object <<<< system.security.AccessControl.FileSystemAccessRule($AccessRuleIdentity, $Permission, $Inheritence, $Propogation, $AccessType)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
What is the proper way to handle / set these types of permissions in PowerShell?