private/Get-AdfObjectByName.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function Get-AdfObjectByName {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true)] [Adf] $adf,
        [parameter(Mandatory = $true)] [String] $name
    )
    
    Write-Debug "BEGIN: Get-AdfObjectByName(name=$name)"
    # if ($null -eq $adf) { Write-Verbose "Variable [adf] is null." } else { Write-Verbose "[adf] is ok." }
    # Write-Verbose "ADF:"
    # Write-Verbose ($adf | Format-List | Out-String)
    # Write-Verbose "-----"

    $r = $adf.AllObjects() | Where-Object { $_.Name -eq $name } | Select-Object -First 1
    # Write-Verbose "---R:"
    Write-Debug ($r | Format-List | Out-String)
    # Write-Verbose "-----"
    Write-Debug "END: Get-AdfObjectByName()"
    return $r
}