Created
June 14, 2015 16:37
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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