Skip to content

Get-AzDomainInfo throwing Illegal characters in path. #34

@Flangyver

Description

@Flangyver

After running Get-AzDomainInfo -verbose I received an Illegal characters in path error for every time Get-AzDomainInfo tried to write any output:
image
This is because the subscription has pipes | in it's name and those are illegal characters for a folder name. To fix my issue I edited lines 173-176 of Get-AzDomainInfo.ps1 to the following code:

    $folderSubscription = $Subscription.replace('|','-')
    if(Test-Path $folder"\"$folderSubscription){}
    else{New-Item -ItemType Directory $folder"\"$folderSubscription | Out-Null}
    
    $folder = -join ($folder, "\", $folderSubscription)

Probably a better solution to catch all Illegal characters is remove any characters from [System.IO.Path]::GetInvalidFileNameChars() -join '' out of the folder name to prevent this issue in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions