Public/Debugging/Get-ASDObjectsByPrefix.ps1


function Get-ASDObjectsByPrefix
{
    Param(
        [Parameter(Mandatory=$false)][String]$Shell,
        [Parameter(Mandatory=$true, Position=0)][String]$Prefix,
        [Parameter(Mandatory=$false, Position=1)][bool]$IgnoreCase=$false
        )

        $shellLocal = Get-ASDefaultShell
        if($PSBoundParameters['Shell'])
        {
            $shellLocal = $Shell
        }
        if([System.String]::IsNullOrEmpty($shellLocal))
        {
            Write-Host 'Target shell is not set. Please specify target shell with -Shell parameter or by Set-ASDefaultShellTarget snippet.'
            return
        }
        $uri = "http://$($shellLocal):4444/api/debugging/GetObjectsByPrefix?prefix=$($Prefix)&ignoreCase=$($IgnoreCase)" 
        $result = Invoke-RestMethod -Uri $uri -Method GET
        $result.value
}