Skip to content

Unhandled exception "Illegal characters in path" in Get-Item #82

@itm4n

Description

@itm4n

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions