have a messed up folder with inconsistent ACLs which I need to uniform. I hoped to accomplish this with powershell. So I'm trying to search for all files missing the required group and applying the rights threough Set-Acl:
Get-Acl | where {$_.accesstostring -notlike "*domain\required_grp*"} | Set-Acl $dir $acl
Unlike icacls, Set-Acl requires you to be the owner of the file to be able to modify the ACL. That's why:
$dir= Get-Acl .\reference_file
$acl= $ACL.SetOwner([System.Security.Principal.NTAccount]$my_account)
Well, when running the command I get the following error:
Set-Acl : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:1 char:95
I'm pretty sure the problem is with the format of the output piped to Set-Acl, but can't figure out what. Thanks for any input, much appreciated.
Luka