Private/Test-SshImportIdAdministratorsAuthorizedKeysPath.ps1

function Test-SshImportIdAdministratorsAuthorizedKeysPath {
    <#
    .SYNOPSIS
        Returns whether a path is Windows OpenSSH's well-known
        administrators_authorized_keys file
        ('%ProgramData%\ssh\administrators_authorized_keys').
 
    .DESCRIPTION
        On Windows, sshd matches members of the local Administrators group
        via a 'Match Group administrators' block that overrides
        AuthorizedKeysFile to this single machine-wide path, instead of the
        per-user '.ssh\authorized_keys'. This check drives both the default
        path used by -ForAdministrators and the stricter ACL rules that
        path requires.
    #>

    [CmdletBinding()]
    [OutputType([bool])]
    param(
        [Parameter(Mandatory)]
        [string] $Path
    )

    $adminPath = Join-Path -Path $env:ProgramData -ChildPath 'ssh\administrators_authorized_keys'

    $normalizedPath = [System.IO.Path]::GetFullPath($Path).TrimEnd('\')
    $normalizedAdminPath = [System.IO.Path]::GetFullPath($adminPath).TrimEnd('\')

    $normalizedPath.Equals($normalizedAdminPath, [StringComparison]::OrdinalIgnoreCase)
}