Starting from Windows 10 Creators Fall Update, you can use VT escape sequences to colorize the output to console. You can use this to colorize columns in Format-Table, too.
A sample snippet, colorizing the output based on the contents of the "Status" field:
$somelist | FT FirstName,LastName,@{l="Status";e={ switch ($_.Status) { "OK" {$color = 92; break} "NOT OK" {$color = 91; break} default {$color = 93} } "$e[${color}m$($_.Status)${e}[0m" }}
A complete list of color codes can be found here: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
« ‹ | November 2024 | › » | ||||
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |