0% found this document useful (0 votes)
25 views1 page

Borra Rusu A Rio Acl

This PowerShell script removes full control permissions recursively for a specified user from all folders starting from a given path. It gets the child folders recursively from the starting path, checks if the ACL contains the specified user, removes the access rule if present, and sets the new ACL on the folder.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Borra Rusu A Rio Acl

This PowerShell script removes full control permissions recursively for a specified user from all folders starting from a given path. It gets the child folders recursively from the starting path, checks if the ACL contains the specified user, removes the access rule if present, and sets the new ACL on the folder.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

$StartingPath = "C:\Users\administrador\Desktop\prueba"

$Right = "fullcontrol"
$Principal = "mio\c"

$Rule = New-Object System.Security.AccessControl.FileSystemAccessRule($Principal,


$Right,"ContainerInherit, ObjectInherit", "None","Allow")

foreach ($Folder in $(Get-ChildItem -Directory $StartingPath -Recurse)) {


$folderName = $Folder.fullname
$Acl=get-acl $folderName
$identidades = $Acl.access.identityreference

if($identidades -contains "MIO\c"){


if($Acl.removeAccessRule($Rule)){
write-host "Usuario $Principal borrado de la carpeta
$folderName"
}
Set-Acl $folderName $Acl
}
}

You might also like