1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ColorMainWindowTitle = @{ Name = "MainWindowTitle" Expression = { switch ($_.MainWindowTitle) { default { $color = "255;0;255" } } $esc = [char]27 "$esc[38;2;${color}m$($_.Name)${esc}[0m" } } Get-Process | Where {$_.MainWindowTitle} | Select-Object ProcessName, $ColorMainWindowTitle |