I found the answer. Microsoft says
Unfortunately
Get-Acl
is missing some features. It always reads the full security descriptor even if you just want to modify the DACL. That’s whySet-ACL
also wants to write the owner even if you have not changed it. Using theGetAccessControl
method allows you to specify what part of the security descriptor you want to read.
Replace the Get-Acl
call with
$acl = (Get-Item $path).GetAccessControl('Access')