Can anyone guide me how can I automate this command?
I configured a specific folder and a specific user and I was able to remove it, but it is to remove any user that is in the folder list.
$Acl = Get-Acl -Path "c:\temp\test"
$Ace = $Acl.Access | Where-Object {($.IdentityReference -eq 'RSA\user1') -and -not ($.IsInherited)}
$Acl.RemoveAccessRule($Ace)
Set-Acl -Path "c:\temp\test" -AclObject $Acl