0

I have an odd problem where I can't remove any files with an empty ACL:

>icacls "avfilter-7_ms.dll" /grant Administrator:F
avfilter-7_ms.dll: Access is denied.

This is what the file looks like:

link

No groups or users have access to this object.

However, when I use the Windows security UI, I am able to add myself as Full Control to the object. I have thousands to delete; is there a way to do this? icacls seems to be completely unable to touch these files.

1 Answers1

0

Played around with .NET a bit and this was able to get the ACL entry added so I can delete a single file (needs a ForEach on Get-ChildItem next):

$rule = new-object System.Security.AccessControl.FileSystemAccessRule "Administrator", "FullControl", "Allow";
$p = "bad_file.txt"
$acl = [System.IO.File]::GetAccessControl($p);
$acl.SetAccessRule($rule);
[System.IO.File]::SetAccessControl($p, $acl);