src/Private/Get-FirstPropertyValue.ps1

function Get-FirstPropertyValue {
    <#
    .SYNOPSIS
        Safe single-value read from a DirectorySearcher property collection: returns $null when
        the attribute is absent/empty rather than indexing [0] on an empty collection (which can
        throw under Set-StrictMode).
    #>

    [CmdletBinding()]
    param(
        $Collection
    )

    if ($Collection -and $Collection.Count -gt 0) { $Collection[0] } else { $null }
}