posted on March 12th 2018, at 08:27
by lunarg

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}

A complete list of color codes can be found here: