Remove any user from NTFS permission

Rafael S. Amaral 1 Reputation point
2022-05-27T12:54:29.667+00:00

Hi guys,

I need to remove any user that is in NTFS permission.

I have the list of folders and child folders, these folders only need to have groups (The groups are already configured), is this possible by powershell?

Thanks!

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rafael S. Amaral 1 Reputation point
    2022-05-27T15:16:39.627+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.