$UaAppProcessNames = @(
    "AirportPortalAPM",
    "GateReader",
    "GoUAL",
    "Jet",
    "PassportReaderCommonUse",
    "PRSAttachmateHelper",
    "StationManager",
    "QSS",
    "UAGRDEV",
    "UASRDEV"
)
$UaUtilProcessNames = @(
    "accmgr32",
    "accsmngr",
    "co-msr",
    "cokeys",
    "cokeys2",
    "goual",
    "guarddog",
    "hllwatch",
    "pt32",
    "passport",
    "ptrstray",
    "spltsrvc"
)
$UaProcessNames = $UaAppProcessNames += $UaUtilProcessNames
$MySessionId = (Get-Process -PID $PID).SessionId

Measure-Command {
    do 
    {
        Clear-Host
        Write-Host "Session ID: $MySessionId"
        $MySessionProcesses = Get-Process | Where-Object {$_.SessionId -eq $MySessionId}
        $UaProcesses = $MySessionProcesses | Where-Object {$UaProcessNames -contains $_.ProcessName}
        if ($UaProcesses.Count -eq 0) {
            Write-Host "No UA applications are running in this session."
            break
        }
        $UaProcesses | ForEach-Object {
            Write-Host "Process ID: $($_.Id), Process Name: $($_.ProcessName)"
        }
        Write-Host
        Write-Host "(refresh interval: 3 seconds)"
        Start-Sleep -Seconds 3
    } until ([System.Console]::KeyAvailable)
}
