In some cases, an "Illegal characters in path" exception is thrown by Get-Item. This error is not caught by -ErrorAction SilentlyContinue. It might be necessary to implement a wrapper cmdlet for Get-Item which executes it within a try/catch block, on top of the ErrorAction option.
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ CATEGORY ┃ TA0004 - Privilege Escalation ┃
┃ NAME ┃ Configuration - COM Image File Permissions ┃
┃ TYPE ┃ Extended ┃
┣━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ Check whether the current user has any modification rights ┃
┃ on a COM server module file. This may not necessarily result ┃
┃ in a privilege escalation. Further analysis is required. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Get-Item : Illegal characters in path.
At line:276 char:30
+ ... idateItem = Get-Item -Path $CandidatePath -Force -ErrorAction Silentl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Item], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.GetItemCommand
In some cases, an "Illegal characters in path" exception is thrown by
Get-Item. This error is not caught by-ErrorAction SilentlyContinue. It might be necessary to implement a wrapper cmdlet forGet-Itemwhich executes it within a try/catch block, on top of theErrorActionoption.