Private/Get-NSPEntraStockAnchorFlow.ps1

function Get-NSPEntraStockAnchorFlow {
    <#
    .SYNOPSIS
        Entra Connect's stock ms-DS-ConsistencyGuid anchor flows, flattened: lower case, no white space.
    .DESCRIPTION
        As seen on a real sync server. Both give no value to a user with msExchRecipientTypeDetails 2.
    #>

    [CmdletBinding()]
    [OutputType([string])]
    param()

    $cg = '[ms-ds-consistencyguid]'
    $oid = '[objectguid]'
    $type = '[msexchrecipienttypedetails]'
    $chosen = '"ms-ds-consistencyguid"="ms-ds-consistencyguid"'

    $bytes = "iif(ispresent($cg),$cg,$oid)"
    $binary = "iif($chosen,$bytes,null)"

    $cgText = "iif(isstring($cg),cstr($cg),converttobase64($cg))"
    $oidText = "iif(isstring($oid),cstr($oid),converttobase64($oid))"
    $text = "iif($chosen,iif(ispresent($cg),$cgText,$oidText),$cgText)"

    "iif(ispresent($type),iif($type=2,null,$binary),$binary)"
    "iif(ispresent($type),iif($type=2,null,$text),$text)"
}