Public/Get-PWSHYBKPIVReader.ps1

function Get-PWSHYBKPIVReader {
    <#
    .SYNOPSIS
        Lists smart card readers visible to yubico-piv-tool.exe.
    .DESCRIPTION
        Wraps "yubico-piv-tool.exe --action list-readers". Read-only - does not support -WhatIf
        since it makes no changes. Accepts the "list-readers" action's config-declared options
        (-ToolVerbose) as dynamic parameters built from Config\Posh-YBKPIV.json.
    .PARAMETER ToolVerbose
        Verbosity level (integer) to pass to yubico-piv-tool.exe's own --verbose flag. Named
        ToolVerbose rather than Verbose to avoid colliding with PowerShell's built-in -Verbose
        common parameter.
    .INPUTS
        None. This cmdlet does not accept pipeline input.
    .OUTPUTS
        String[]. yubico-piv-tool.exe's raw reader list output, one line per array element.
    .NOTES
        -ToolVerbose is declared dynamically from Config\Posh-YBKPIV.json and therefore does not
        appear in Get-Help's PARAMETERS/SYNTAX sections. Run
        `Get-Command Get-PWSHYBKPIVReader -Syntax` for the authoritative, current parameter list.
    .EXAMPLE
        Get-PWSHYBKPIVReader
        Lists the smart card readers currently visible to yubico-piv-tool.exe.
    .LINK
        https://developers.yubico.com/yubico-piv-tool/Actions/
    .LINK
        Get-PWSHYBKPIVStatus
    #>

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

    DynamicParam {
        $dynamicConfig = Read-PWSHYBKPIVConfigFile
        Get-PWSHYBKPIVActionParameter -Action 'list-readers' -CmdletWrapping $dynamicConfig.cmdletWrapping
    }

    begin {
        $config = Read-PWSHYBKPIVConfigFile
        Write-PWSHYBKPIVLog -Config $config -Level Debug -CmdletName $MyInvocation.MyCommand.Name `
            -Message 'Cmdlet invoked' -BoundParameters $PSBoundParameters

        $architecture = Resolve-PWSHYBKPIVArchitecture -Architecture $config.installation.architecture
        $exePath = Get-PWSHYBKPIVInstallPath -Installation $config.installation -Architecture $architecture
        if (-not (Test-Path -Path $exePath -PathType Leaf)) {
            throw "yubico-piv-tool.exe was not found at '$exePath'. Run Install-PWSHYBKPIVTool first."
        }
    }

    end {
        try {
            $result = Invoke-PWSHYBKPIVTool -ExePath $exePath -Action 'list-readers' `
                -CmdletWrapping $config.cmdletWrapping -BoundParameters $PSBoundParameters
            Write-PWSHYBKPIVLog -Config $config -Level Information -CmdletName $MyInvocation.MyCommand.Name `
                -Message 'Readers listed successfully'
            $result.Output
        } catch {
            Write-PWSHYBKPIVLog -Config $config -Level Error -CmdletName $MyInvocation.MyCommand.Name -Message "Failed: $_"
            throw
        }
    }
}