Samples/PagingHelperEarlyExit.ps1

# With this script you get the exact endpoint with the build-in paging helper method Select-bCPageData and an piping early exit
# This script serves as an piping example

# Sets Write-Information for console output
# PowerShell default is SilentlyContinue
$InformationPreference = "Continue"

$mySpecificEndpointName = "yourEndpointName"

try {
    # Piping example: get exact endpoints
    # Get exact windows endpoint
    $specificEndpoint = Get-bCEndpointsWindowsEndpoints -GetAllPages `
                                | Select-bCPageData `
                                | Where-Object {
                                    Write-Information "Processing Endpoint $($_.displayName)"
                                    return $_.displayName -eq $mySpecificEndpointName
                                } `
                                | Select-Object -First 1 # Exits the pipeline after finding the first match
    Write-Output "Found Endpoint: $($specificEndpoint)"
}
catch {
    Write-Error "Error occured: $($_.Exception)"
}