Skip to content

Instantly share code, notes, and snippets.

@vbfox
Created October 29, 2014 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vbfox/8fbec5c60b0c16289023 to your computer and use it in GitHub Desktop.
Save vbfox/8fbec5c60b0c16289023 to your computer and use it in GitHub Desktop.
Fixes "This access control list is not in canonical form" on a folder
param([string]$dir);
$out = icacls "$dir" /verify /t /q
Foreach($line in $out)
{
if ($line -match '(.:[^:]*): (.*)')
{
$path = $Matches[1]
$acl = Get-Acl $path
Set-Acl $path $acl
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment