Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kenny-evitt/d2937021e4220d65690f to your computer and use it in GitHub Desktop.
Save kenny-evitt/d2937021e4220d65690f to your computer and use it in GitHub Desktop.
Remove "Deny" Windows ACL entries on all items in a directory, recursively
Get-ChildItem -Path C:\@GitHub\LightTable\builds\lighttable-0.8.0-windows\resources\app\core\node_modules\lighttable -Recurse |
ForEach-Object {
$itemPath = $_.FullName
$acl = Get-Acl $itemPath
foreach ($accessRule in $acl.Access)
{
if ($accessRule.AccessControlType -eq [System.Security.AccessControl.AccessControlType]::Deny -and $accessRule.IdentityReference.Value -eq "RECP\kevitt")
{
$acl.RemoveAccessRule($accessRule)
}
}
Set-Acl -Path $itemPath -AclObject $acl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment