# SkyLogic port bulucu — VID:PID 303A:1001 tek CDC portunu bulur.
# Cikti: tek satir  ->  COMxx  |  YOK  |  COKLU:COM3,COM5
$d = Get-CimInstance Win32_PnPEntity | Where-Object {
    $_.DeviceID -match 'VID_303A&PID_1001' -and $_.Name -match '\(COM\d+\)'
}
$ports = @($d | ForEach-Object {
    if ($_.Name -match '\((COM\d+)\)') { $matches[1] }
})
if     ($ports.Count -eq 1) { $ports[0] }
elseif ($ports.Count -eq 0) { 'YOK' }
else                        { 'COKLU:' + ($ports -join ',') }
