Borra Rusu A Rio Acl

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 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