Reputation: 67
I have an arraylist of all folders and files where I want to get the ACL off. Everything runs well in my Foreach loop.
But for one odd reason it throws:
Get-Acl : Illegal characters + CategoryInfo : NotSpecified: (:) [Get-Acl], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.GetAclCommand
When I run the get-acl manual with the 'faulty' path, I get the ACL. My code is:
$ACL = get-acl -LiteralPath "$Path" | select -ExpandProperty access | select IdentityReference
$Result = Compare-Object -ReferenceObject $ACLListAccess -DifferenceObject $ACL -Property Access -PassThru
if ($Result.count -ne 0)
{
$ExplicitTest = get-acl -LiteralPath "$Path" | select -ExpandProperty access
if ($ExplicitTest.IsInherited.count -ne $ACLListAccessFull.count -and $ExplicitTest.IsInherited -Like "*False*")
{
$WrongFolders.Add($Path) | Out-Null
}
}
The Path with the 'illegal character' is \mycompany.com\folders\Algemeen\Reme§ysen
Upvotes: 0
Views: 880
Reputation: 6605
Sorry, cannot repro your problem and comment does not allow me to paste this
D:\temp\a> get-acl .\aaa§bbb
Directory: D:\temp\a
Path Owner Access
---- ----- ------
aaa§bbb adil BUILTIN\Administrators Allow FullControl...
if you copy paste that character, do you also get 167?
C:\> [int][char]'§'
167
Upvotes: 0